[FFmpeg-user] yuvtestsrc to y4m differs with and without format rgba->yuv444p conversion
Paul B Mahol
onemda at gmail.com
Sun Sep 8 21:12:32 EEST 2024
On Sun, Sep 8, 2024 at 7:49 AM Andrew Randrianasulu <randrianasulu at gmail.com>
wrote:
> git up to d9f594209fb1a9c87017034f943dcb311a9d2896
>
> first command
> ====
>
> bash-5.1$ /dev/shm/ffmpeg/ffmpeg -f lavfi -i yuvtestsrc -frames 1 -r
> 25 -vf format=rgba,format=yuv444p -color_range 1
> /dev/shm/yuv-mpeg-rgba-yuv444p.y4m -debug log
> ffmpeg version N-115688-gd9f594209f Copyright (c) 2000-2024 the FFmpeg
> developers
> built with gcc 11.2.0 (GCC)
> configuration: --disable-debug
> libavutil 59. 35.100 / 59. 35.100
> libavcodec 61. 11.100 / 61. 11.100
> libavformat 61. 5.101 / 61. 5.101
> libavdevice 61. 2.100 / 61. 2.100
> libavfilter 10. 2.102 / 10. 2.102
> libswscale 8. 2.100 / 8. 2.100
> libswresample 5. 2.100 / 5. 2.100
> matched as AVOption 'debug' with argument 'log'.
> Trailing option(s) found in the command: may be ignored.
> Finished splitting the commandline.
> Parsing a group of options: global .
> Successfully parsed a group of options.
> Parsing a group of options: input url yuvtestsrc.
> Applying option f (force container format (auto-detected otherwise))
> with argument lavfi.
> Successfully parsed a group of options.
> Opening an input file: yuvtestsrc.
> detected 4 logical cores
> [Parsed_yuvtestsrc_0 @ 0xb8276c0] size:320x240 rate:25/1
> duration:-1.000000 sar:1/1
> [AVFilterGraph @ 0xb826f00] query_formats: 2 queried, 3 merged, 0
> already done, 0 delayed
> [lavfi @ 0xb826840] All info found
> Input #0, lavfi, from 'yuvtestsrc':
> Duration: N/A, start: 0.000000, bitrate: N/A
> Stream #0:0, 1, 1/25: Video: wrapped_avframe, 1 reference frame,
> yuv444p, 320x240 [SAR 1:1 DAR 4:3], 0/1, 25 fps, 25 tbr, 25 tbn
> Successfully opened the file.
> Parsing a group of options: output url /dev/shm/yuv-mpeg-rgba-yuv444p.y4m.
> Applying option frames (set the number of frames to output) with argument
> 1.
> Applying option r (override input framerate/convert to given output
> framerate (Hz value, fraction or abbreviation)) with argument 25.
> Applying option vf (alias for -filter:v (apply filters to video
> streams)) with argument format=rgba,format=yuv444p.
> Successfully parsed a group of options.
> Opening an output file: /dev/shm/yuv-mpeg-rgba-yuv444p.y4m.
> [out#0/yuv4mpegpipe @ 0xb863900] No explicit maps, mapping streams
> automatically...
> [vost#0:0/wrapped_avframe @ 0xb864080] Created video stream from input
> stream 0:0
> [AVFilterGraph @ 0xb865680] Setting 'pix_fmts' to value 'rgba'
> [AVFilterGraph @ 0xb865680] Setting 'pix_fmts' to value 'yuv444p'
> File '/dev/shm/yuv-mpeg-rgba-yuv444p.y4m' already exists. Overwrite? [y/N]
> y
> [file @ 0xb862600] Setting default whitelist 'file,crypto,data'
> Successfully opened the file.
> Stream mapping:
> Stream #0:0 -> #0:0 (wrapped_avframe (native) -> wrapped_avframe
> (native))
> [vost#0:0/wrapped_avframe @ 0xb864080] Starting thread...
> [vf#0:0 @ 0xb865300] Starting thread...
> [vist#0:0/wrapped_avframe @ 0xb8632c0] [dec:wrapped_avframe @
> 0xb866f80] Starting thread...
> [in#0/lavfi @ 0xb8265c0] Starting thread...
> Press [q] to stop, [?] for help
> [AVFilterGraph @ 0xf3900a40] Setting 'pix_fmts' to value 'rgba'
> [AVFilterGraph @ 0xf3900a40] Setting 'pix_fmts' to value 'yuv444p'
> [graph -1 input from stream 0:0 @ 0xf3901f80] Setting 'video_size' to
> value '320x240'
> [graph -1 input from stream 0:0 @ 0xf3901f80] Setting 'pix_fmt' to value
> '5'
> [graph -1 input from stream 0:0 @ 0xf3901f80] Setting 'time_base' to
> value '1/25'
> [graph -1 input from stream 0:0 @ 0xf3901f80] Setting 'pixel_aspect'
> to value '1/1'
> [graph -1 input from stream 0:0 @ 0xf3901f80] Setting 'colorspace' to
> value '2'
> [graph -1 input from stream 0:0 @ 0xf3901f80] Setting 'range' to value '0'
> [graph -1 input from stream 0:0 @ 0xf3901f80] Setting 'frame_rate' to
> value '25/1'
> [graph -1 input from stream 0:0 @ 0xf3901f80] w:320 h:240
> pixfmt:yuv444p tb:1/25 fr:25/1 sar:1/1 csp:unknown range:unknown
> [auto_scale_0 @ 0xf3903d80] w:iw h:ih flags:'' interl:0
> [Parsed_format_0 @ 0xf39015c0] auto-inserting filter 'auto_scale_0'
> between the filter 'graph -1 input from stream 0:0' and the filter
> 'Parsed_format_0'
> [auto_scale_1 @ 0xf390e940] w:iw h:ih flags:'' interl:0
> [Parsed_format_1 @ 0xf39018c0] auto-inserting filter 'auto_scale_1'
> between the filter 'Parsed_format_0' and the filter 'Parsed_format_1'
> [AVFilterGraph @ 0xf3900a40] query_formats: 4 queried, 3 merged, 6
> already done, 0 delayed
> [swscaler @ 0xf3919040] [swscaler @ 0xf3922480] Forcing full internal
> H chroma due to input having non subsampled chroma
> [swscaler @ 0xf3919040] [swscaler @ 0xf393c140] Forcing full internal
> H chroma due to input having non subsampled chroma
> [swscaler @ 0xf3919040] [swscaler @ 0xf3955600] Forcing full internal
> H chroma due to input having non subsampled chroma
> [swscaler @ 0xf3919040] [swscaler @ 0xf396f2c0] Forcing full internal
> H chroma due to input having non subsampled chroma
> [swscaler @ 0xf3919040] [swscaler @ 0xf3988780] Forcing full internal
> H chroma due to input having non subsampled chroma
> [auto_scale_0 @ 0xf3903d80] w:320 h:240 fmt:yuv444p csp:unknown
> range:unknown sar:1/1 -> w:320 h:240 fmt:rgba csp:gbr range:pc sar:1/1
> flags:0x00000004
> [auto_scale_0 @ 0xf3903d80] [framesync @ 0xf3903e14] Selected 1/25 time
> base
> [auto_scale_0 @ 0xf3903d80] [framesync @ 0xf3903e14] Sync level 1
> [auto_scale_1 @ 0xf390e940] w:320 h:240 fmt:rgba csp:gbr range:pc
> sar:1/1 -> w:320 h:240 fmt:yuv444p csp:unknown range:unknown sar:1/1
> flags:0x00000004
> [auto_scale_1 @ 0xf390e940] [framesync @ 0xf390ea14] Selected 1/25 time
> base
> [auto_scale_1 @ 0xf390e940] [framesync @ 0xf390ea14] Sync level 1
> [graph -1 input from stream 0:0 @ 0xf3901f80] video frame properties
> congruent with link at pts_time: 0
> Output #0, yuv4mpegpipe, to '/dev/shm/yuv-mpeg-rgba-yuv444p.y4m':
> Metadata:
> encoder : Lavf61.5.101
> Stream #0:0, 0, 1/25: Video: wrapped_avframe, 1 reference frame,
> yuv444p(progressive), 320x240 [SAR 1:1 DAR 4:3], 0/1, q=2-31, 200
> kb/s, 25 fps, 25 tbn
> Metadata:
> encoder : Lavc61.11.100 wrapped_avframe
> [out#0/yuv4mpegpipe @ 0xb863900] Starting thread...
> [out#0/yuv4mpegpipe @ 0xb863900] sq: send 0 ts 0.04
> [out#0/yuv4mpegpipe @ 0xb863900] sq: 0 frames_max 1 reached
> [out#0/yuv4mpegpipe @ 0xb863900] sq: finish 0; head ts 0.04
> [out#0/yuv4mpegpipe @ 0xb863900] sq: finish queue
> [out#0/yuv4mpegpipe @ 0xb863900] sq: receive 0 ts 0.04 queue head 0 ts 0.04
> [vf#0:0 @ 0xb865300] All consumers returned EOF
> [vost#0:0/wrapped_avframe @ 0xb864080] Encoder thread received EOF
> [vost#0:0/wrapped_avframe @ 0xb864080] Terminating thread with return
> code 0 (success)
> [out#0/yuv4mpegpipe @ 0xb863900] All streams finished
> [out#0/yuv4mpegpipe @ 0xb863900] Terminating thread with return code 0
> (success)
> [out#0/yuv4mpegpipe @ 0xb863900] sq: 0 EOF
> [out#0/yuv4mpegpipe @ 0xb863900] sq: finish queue
> [vf#0:0 @ 0xb865300] Terminating thread with return code 0 (success)
> [vist#0:0/wrapped_avframe @ 0xb8632c0] [dec:wrapped_avframe @
> 0xb866f80] Decoder returned EOF, finishing
> [vist#0:0/wrapped_avframe @ 0xb8632c0] [dec:wrapped_avframe @
> 0xb866f80] Terminating thread with return code 0 (success)
> [vist#0:0/wrapped_avframe @ 0xb8632c0] All consumers of this stream are
> done
> [in#0/lavfi @ 0xb8265c0] All consumers are done
> [in#0/lavfi @ 0xb8265c0] Terminating thread with return code 0 (success)
> [AVIOContext @ 0xb865940] Statistics: 230456 bytes written, 0 seeks, 1
> writeouts
> [out#0/yuv4mpegpipe @ 0xb863900] Output file #0
> (/dev/shm/yuv-mpeg-rgba-yuv444p.y4m):
> [out#0/yuv4mpegpipe @ 0xb863900] Output stream #0:0 (video): 1
> frames encoded; 1 packets muxed (308 bytes);
> [out#0/yuv4mpegpipe @ 0xb863900] Total: 1 packets (308 bytes) muxed
> [out#0/yuv4mpegpipe @ 0xb863900] video:0KiB audio:0KiB subtitle:0KiB
> other streams:0KiB global headers:0KiB muxing overhead: 74723.376623%
> frame= 1 fps=0.0 q=-0.0 Lsize= 225KiB time=00:00:00.04
> bitrate=46091.2kbits/s speed=3.17x
> [in#0/lavfi @ 0xb8265c0] Input file #0 (yuvtestsrc):
> [in#0/lavfi @ 0xb8265c0] Input stream #0:0 (video): 19 packets read
> (5852 bytes); 10 frames decoded; 0 decode errors;
> [in#0/lavfi @ 0xb8265c0] Total: 19 packets (5852 bytes) demuxed
>
> =======
>
> second command
>
> bash-5.1$ /dev/shm/ffmpeg/ffmpeg -f lavfi -i yuvtestsrc -frames 1 -r
> 25 -color_range 1 /dev/shm/yuv-mpeg-yuv444p.y4m -debug log
> ffmpeg version N-115688-gd9f594209f Copyright (c) 2000-2024 the FFmpeg
> developers
> built with gcc 11.2.0 (GCC)
> configuration: --disable-debug
> libavutil 59. 35.100 / 59. 35.100
> libavcodec 61. 11.100 / 61. 11.100
> libavformat 61. 5.101 / 61. 5.101
> libavdevice 61. 2.100 / 61. 2.100
> libavfilter 10. 2.102 / 10. 2.102
> libswscale 8. 2.100 / 8. 2.100
> libswresample 5. 2.100 / 5. 2.100
> matched as AVOption 'debug' with argument 'log'.
> Trailing option(s) found in the command: may be ignored.
> Finished splitting the commandline.
> Parsing a group of options: global .
> Successfully parsed a group of options.
> Parsing a group of options: input url yuvtestsrc.
> Applying option f (force container format (auto-detected otherwise))
> with argument lavfi.
> Successfully parsed a group of options.
> Opening an input file: yuvtestsrc.
> detected 4 logical cores
> [Parsed_yuvtestsrc_0 @ 0xb0fc640] size:320x240 rate:25/1
> duration:-1.000000 sar:1/1
> [AVFilterGraph @ 0xb0fbec0] query_formats: 2 queried, 3 merged, 0
> already done, 0 delayed
> [lavfi @ 0xb0fb800] All info found
> Input #0, lavfi, from 'yuvtestsrc':
> Duration: N/A, start: 0.000000, bitrate: N/A
> Stream #0:0, 1, 1/25: Video: wrapped_avframe, 1 reference frame,
> yuv444p, 320x240 [SAR 1:1 DAR 4:3], 0/1, 25 fps, 25 tbr, 25 tbn
> Successfully opened the file.
> Parsing a group of options: output url /dev/shm/yuv-mpeg-yuv444p.y4m.
> Applying option frames (set the number of frames to output) with argument
> 1.
> Applying option r (override input framerate/convert to given output
> framerate (Hz value, fraction or abbreviation)) with argument 25.
> Successfully parsed a group of options.
> Opening an output file: /dev/shm/yuv-mpeg-yuv444p.y4m.
> [out#0/yuv4mpegpipe @ 0xb1387c0] No explicit maps, mapping streams
> automatically...
> [vost#0:0/wrapped_avframe @ 0xb138f40] Created video stream from input
> stream 0:0
> File '/dev/shm/yuv-mpeg-yuv444p.y4m' already exists. Overwrite? [y/N] y
> [file @ 0xb13a600] Setting default whitelist 'file,crypto,data'
> Successfully opened the file.
> Stream mapping:
> Stream #0:0 -> #0:0 (wrapped_avframe (native) -> wrapped_avframe
> (native))
> [vost#0:0/wrapped_avframe @ 0xb138f40] Starting thread...
> [vf#0:0 @ 0xb13a1c0] Starting thread...
> [vist#0:0/wrapped_avframe @ 0xb138180] [dec:wrapped_avframe @
> 0xb13b5c0] Starting thread...
> [in#0/lavfi @ 0xb0fb580] Starting thread...
> Press [q] to stop, [?] for help
> [graph -1 input from stream 0:0 @ 0xf41016c0] Setting 'video_size' to
> value '320x240'
> [graph -1 input from stream 0:0 @ 0xf41016c0] Setting 'pix_fmt' to value
> '5'
> [graph -1 input from stream 0:0 @ 0xf41016c0] Setting 'time_base' to
> value '1/25'
> [graph -1 input from stream 0:0 @ 0xf41016c0] Setting 'pixel_aspect'
> to value '1/1'
> [graph -1 input from stream 0:0 @ 0xf41016c0] Setting 'colorspace' to
> value '2'
> [graph -1 input from stream 0:0 @ 0xf41016c0] Setting 'range' to value '0'
> [graph -1 input from stream 0:0 @ 0xf41016c0] Setting 'frame_rate' to
> value '25/1'
> [graph -1 input from stream 0:0 @ 0xf41016c0] w:320 h:240
> pixfmt:yuv444p tb:1/25 fr:25/1 sar:1/1 csp:unknown range:unknown
> [AVFilterGraph @ 0xf4100a40] query_formats: 3 queried, 6 merged, 0
> already done, 0 delayed
> [graph -1 input from stream 0:0 @ 0xf41016c0] video frame properties
> congruent with link at pts_time: 0
> Output #0, yuv4mpegpipe, to '/dev/shm/yuv-mpeg-yuv444p.y4m':
> Metadata:
> encoder : Lavf61.5.101
> Stream #0:0, 0, 1/25: Video: wrapped_avframe, 1 reference frame,
> yuv444p(progressive), 320x240 [SAR 1:1 DAR 4:3], 0/1, q=2-31, 200
> kb/s, 25 fps, 25 tbn
> Metadata:
> encoder : Lavc61.11.100 wrapped_avframe
> [out#0/yuv4mpegpipe @ 0xb1387c0] Starting thread...
> [out#0/yuv4mpegpipe @ 0xb1387c0] sq: send 0 ts 0.04
> [out#0/yuv4mpegpipe @ 0xb1387c0] sq: 0 frames_max 1 reached
> [out#0/yuv4mpegpipe @ 0xb1387c0] sq: finish 0; head ts 0.04
> [out#0/yuv4mpegpipe @ 0xb1387c0] sq: finish queue
> [out#0/yuv4mpegpipe @ 0xb1387c0] sq: receive 0 ts 0.04 queue head 0 ts 0.04
> [vf#0:0 @ 0xb13a1c0] All consumers returned EOF
> [vost#0:0/wrapped_avframe @ 0xb138f40] Encoder thread received EOF
> [vost#0:0/wrapped_avframe @ 0xb138f40] Terminating thread with return
> code 0 (success)
> [out#0/yuv4mpegpipe @ 0xb1387c0] sq: 0 EOF
> [out#0/yuv4mpegpipe @ 0xb1387c0] sq: finish queue
> [vf#0:0 @ 0xb13a1c0] Terminating thread with return code 0 (success)
> [vist#0:0/wrapped_avframe @ 0xb138180] [dec:wrapped_avframe @
> 0xb13b5c0] Decoder returned EOF, finishing
> [vist#0:0/wrapped_avframe @ 0xb138180] [dec:wrapped_avframe @
> 0xb13b5c0] Terminating thread with return code 0 (success)
> [vist#0:0/wrapped_avframe @ 0xb138180] All consumers of this stream are
> done
> [in#0/lavfi @ 0xb0fb580] All consumers are done
> [in#0/lavfi @ 0xb0fb580] Terminating thread with return code 0 (success)
> [out#0/yuv4mpegpipe @ 0xb1387c0] All streams finished
> [out#0/yuv4mpegpipe @ 0xb1387c0] Terminating thread with return code 0
> (success)
> [AVIOContext @ 0xb13a900] Statistics: 230456 bytes written, 0 seeks, 1
> writeouts
> [out#0/yuv4mpegpipe @ 0xb1387c0] Output file #0
> (/dev/shm/yuv-mpeg-yuv444p.y4m):
> [out#0/yuv4mpegpipe @ 0xb1387c0] Output stream #0:0 (video): 1
> frames encoded; 1 packets muxed (308 bytes);
> [out#0/yuv4mpegpipe @ 0xb1387c0] Total: 1 packets (308 bytes) muxed
> [out#0/yuv4mpegpipe @ 0xb1387c0] video:0KiB audio:0KiB subtitle:0KiB
> other streams:0KiB global headers:0KiB muxing overhead: 74723.376623%
> frame= 1 fps=0.0 q=-0.0 Lsize= 225KiB time=00:00:00.04
> bitrate=46091.2kbits/s speed=9.67x
> [in#0/lavfi @ 0xb0fb580] Input file #0 (yuvtestsrc):
> [in#0/lavfi @ 0xb0fb580] Input stream #0:0 (video): 19 packets read
> (5852 bytes); 10 frames decoded; 0 decode errors;
> [in#0/lavfi @ 0xb0fb580] Total: 19 packets (5852 bytes) demuxed
>
> resulting files differ significally at the end of each bar in
> YUVViewer and in cingg with Subtract mode ( I am debugging our
> colorspace problem)
>
> /dev/shm/ffmpeg/ffprobe /dev/shm/yuv-mpeg-rgba-yuv444p.y4m
> ffprobe version N-115688-gd9f594209f Copyright (c) 2007-2024 the
> FFmpeg developers
> built with gcc 11.2.0 (GCC)
> configuration: --disable-debug
> libavutil 59. 35.100 / 59. 35.100
> libavcodec 61. 11.100 / 61. 11.100
> libavformat 61. 5.101 / 61. 5.101
> libavdevice 61. 2.100 / 61. 2.100
> libavfilter 10. 2.102 / 10. 2.102
> libswscale 8. 2.100 / 8. 2.100
> libswresample 5. 2.100 / 5. 2.100
> Input #0, yuv4mpegpipe, from '/dev/shm/yuv-mpeg-rgba-yuv444p.y4m':
> Duration: 00:00:00.04, start: 0.000000, bitrate: 46091 kb/s
> Stream #0:0: Video: rawvideo (444P / 0x50343434),
> yuv444p(progressive), 320x240, SAR 1:1 DAR 4:3, 25 fps, 25 tbr, 25 tbn
>
> =========
>
> /dev/shm/ffmpeg/ffprobe /dev/shm/yuv-mpeg-yuv444p.y4m
> ffprobe version N-115688-gd9f594209f Copyright (c) 2007-2024 the
> FFmpeg developers
> built with gcc 11.2.0 (GCC)
> configuration: --disable-debug
> libavutil 59. 35.100 / 59. 35.100
> libavcodec 61. 11.100 / 61. 11.100
> libavformat 61. 5.101 / 61. 5.101
> libavdevice 61. 2.100 / 61. 2.100
> libavfilter 10. 2.102 / 10. 2.102
> libswscale 8. 2.100 / 8. 2.100
> libswresample 5. 2.100 / 5. 2.100
> Input #0, yuv4mpegpipe, from '/dev/shm/yuv-mpeg-yuv444p.y4m':
> Duration: 00:00:00.04, start: 0.000000, bitrate: 46091 kb/s
> Stream #0:0: Video: rawvideo (444P / 0x50343434),
> yuv444p(progressive), 320x240, SAR 1:1 DAR 4:3, 25 fps, 25 tbr, 25 tbn
>
>
> Is this known problem? I see some range flags for swscaler not set,
> may be this is root of problem?
>
Conversion within discrete and limited precision values from yuv->rgb->yuv
is not lossless.
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
>
More information about the ffmpeg-user
mailing list