[FFmpeg-user] Changes in output when truncating bit-depth of RGB frames

Tobias Rapp t.rapp at noa-archive.com
Mon Mar 29 17:20:53 EEST 2021


Hello,

when running some local regression tests for the upcoming v4.4 release I 
noticed that the output checksum of some RGB test has changed. It seems 
to happen when RGB input data having a bit-depth above 8-bit is 
truncated to 8-bit and is caused by the change in commit 
a48adcd1369131ebadd1c928fe790c72795182a7.

As the commit is targeted at RGB to YUV conversion I wonder why a 
conversion like from gbrp12le to gbrp is affected by this change. Does 
the swscaler temporarily convert to YUV when truncating RGB?

Example command:

ffmpeg -i FFVHuff_RGB12bit-720p25__Stereo-PCM24bit__FfMpegTestSrc.avi \
   -f framemd5 -map 0:v -filter:v "format=gbrp" -t 0.1 \
   -y /dev/stdout - report

Report file output is attached. The generated checksums are different 
before/after the commit in git history.

Regards,
Tobias
-------------- next part --------------
ffmpeg started on 2021-03-29 at 15:17:51
Report written to "ffmpeg-20210329-151751.log"
Log level: 48
Command line:
./build-linux/ffmpeg -i /mnt/lux01-user/UserSpace/Tobias/TestFiles/AVI-HuffYuv/FFVHuff_RGB12bit-720p25__Stereo-PCM24bit__FfMpegTestSrc.avi -f framemd5 -map 0:v -filter:v "format=gbrp" -t 0.1 -y /dev/stdout -report
ffmpeg version N-99483-ga48adcd Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.12) 20160609
  configuration: --disable-network --enable-libsoxr --enable-libtwolame --enable-libmp3lame --enable-libvorbis --enable-libfreetype --enable-static --disable-shared --prefix=/usr/local
  libavutil      56. 60.100 / 56. 60.100
  libavcodec     58.109.100 / 58.109.100
  libavformat    58. 61.100 / 58. 61.100
  libavdevice    58. 11.102 / 58. 11.102
  libavfilter     7. 87.100 /  7. 87.100
  libswscale      5.  8.100 /  5.  8.100
  libswresample   3.  8.100 /  3.  8.100
Splitting the commandline.
Reading option '-i' ... matched as input url with argument '/mnt/lux01-user/UserSpace/Tobias/TestFiles/AVI-HuffYuv/FFVHuff_RGB12bit-720p25__Stereo-PCM24bit__FfMpegTestSrc.avi'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'framemd5'.
Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument '0:v'.
Reading option '-filter:v' ... matched as option 'filter' (set stream filtergraph) with argument 'format=gbrp'.
Reading option '-t' ... matched as option 't' (record or transcode "duration" seconds of audio/video) with argument '0.1'.
Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'.
Reading option '/dev/stdout' ... matched as output url.
Reading option '-report' ... matched as option 'report' (generate a report) with argument '1'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option y (overwrite output files) with argument 1.
Applying option report (generate a report) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input url /mnt/lux01-user/UserSpace/Tobias/TestFiles/AVI-HuffYuv/FFVHuff_RGB12bit-720p25__Stereo-PCM24bit__FfMpegTestSrc.avi.
Successfully parsed a group of options.
Opening an input file: /mnt/lux01-user/UserSpace/Tobias/TestFiles/AVI-HuffYuv/FFVHuff_RGB12bit-720p25__Stereo-PCM24bit__FfMpegTestSrc.avi.
[NULL @ 0x3f8d780] Opening '/mnt/lux01-user/UserSpace/Tobias/TestFiles/AVI-HuffYuv/FFVHuff_RGB12bit-720p25__Stereo-PCM24bit__FfMpegTestSrc.avi' for reading
[file @ 0x3f8f900] Setting default whitelist 'file,crypto,data'
[avi @ 0x3f8d780] Format avi probed with size=2048 and score=100
[avi @ 0x3f8fa80] use odml:1
[avi @ 0x3f8d780] Before avformat_find_stream_info() pos: 10274 bytes read:143080 seeks:6 nb_streams:2
[avi @ 0x3f8d780] parser not found for codec ffvhuff, packets or times may be invalid.
[avi @ 0x3f8d780] parser not found for codec pcm_s24le, packets or times may be invalid.
[avi @ 0x3f8d780] parser not found for codec ffvhuff, packets or times may be invalid.
[avi @ 0x3f8d780] parser not found for codec pcm_s24le, packets or times may be invalid.
[avi @ 0x3f8d780] All info found
[avi @ 0x3f8d780] After avformat_find_stream_info() pos: 2724950 bytes read:2884756 seeks:6 frames:2
Input #0, avi, from '/mnt/lux01-user/UserSpace/Tobias/TestFiles/AVI-HuffYuv/FFVHuff_RGB12bit-720p25__Stereo-PCM24bit__FfMpegTestSrc.avi':
  Metadata:
    encoder         : Lavf58.45.100
  Duration: 00:00:05.00, start: 0.000000, bitrate: 541570 kb/s
    Stream #0:0, 1, 1/25: Video: ffvhuff (FFVH / 0x48564646), gbrp12le, 1280x720, 543584 kb/s, SAR 1:1 DAR 16:9, 25 fps, 25 tbr, 25 tbn, 25 tbc
    Stream #0:1, 1, 1/48000: Audio: pcm_s24le ([1][0][0][0] / 0x0001), 48000 Hz, stereo, s32 (24 bit), 2304 kb/s
Successfully opened the file.
Parsing a group of options: output url /dev/stdout.
Applying option f (force format) with argument framemd5.
Applying option map (set input stream mapping) with argument 0:v.
Applying option filter:v (set stream filtergraph) with argument format=gbrp.
Applying option t (record or transcode "duration" seconds of audio/video) with argument 0.1.
Successfully parsed a group of options.
Opening an output file: /dev/stdout.
[file @ 0x3f97940] Setting default whitelist 'file,crypto,data'
Successfully opened the file.
detected 4 logical cores
Stream mapping:
  Stream #0:0 -> #0:0 (ffvhuff (native) -> rawvideo (native))
Press [q] to stop, [?] for help
cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
cur_dts is invalid st:0 (0) [init:0 i_done:0 finish:0] (this is harmless if it occurs once at the start per stream)
[Parsed_format_0 @ 0x3fb7dc0] Setting 'pix_fmts' to value 'gbrp'
[graph 0 input from stream 0:0 @ 0x3fb8700] Setting 'video_size' to value '1280x720'
[graph 0 input from stream 0:0 @ 0x3fb8700] Setting 'pix_fmt' to value '137'
[graph 0 input from stream 0:0 @ 0x3fb8700] Setting 'time_base' to value '1/25'
[graph 0 input from stream 0:0 @ 0x3fb8700] Setting 'pixel_aspect' to value '1/1'
[graph 0 input from stream 0:0 @ 0x3fb8700] Setting 'frame_rate' to value '25/1'
[graph 0 input from stream 0:0 @ 0x3fb8700] w:1280 h:720 pixfmt:gbrp12le tb:1/25 fr:25/1 sar:1/1
[auto_scaler_0 @ 0x45d4e40] Setting 'flags' to value 'bicubic'
[auto_scaler_0 @ 0x45d4e40] w:iw h:ih flags:'bicubic' interl:0
[Parsed_format_0 @ 0x3fb7dc0] auto-inserting filter 'auto_scaler_0' between the filter 'graph 0 input from stream 0:0' and the filter 'Parsed_format_0'
[AVFilterGraph @ 0x42b9980] query_formats: 4 queried, 2 merged, 1 already done, 0 delayed
[swscaler @ 0x460a3c0] Forcing full internal H chroma due to input having non subsampled chroma
[auto_scaler_0 @ 0x45d4e40] w:1280 h:720 fmt:gbrp12le sar:1/1 -> w:1280 h:720 fmt:gbrp sar:1/1 flags:0x4
Output #0, framemd5, to '/dev/stdout':
  Metadata:
    encoder         : Lavf58.61.100
    Stream #0:0, 0, 1/25: Video: rawvideo (G3[0][8] / 0x8003347), gbrp, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 552960 kb/s, 25 fps, 25 tbn, 25 tbc
    Metadata:
      encoder         : Lavc58.109.100 rawvideo
Clipping frame in rate conversion by 0.000008
[out_0_0 @ 0x45d3940] EOF on sink link out_0_0:default.
No more output streams to write to, finishing.
frame=    3 fps=0.0 q=-0.0 Lsize=       0kB time=00:00:00.12 bitrate=  30.4kbits/s speed=1.12x    
video:8100kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Input file #0 (/mnt/lux01-user/UserSpace/Tobias/TestFiles/AVI-HuffYuv/FFVHuff_RGB12bit-720p25__Stereo-PCM24bit__FfMpegTestSrc.avi):
  Input stream #0:0 (video): 8 packets read (21743512 bytes); 5 frames decoded; 
  Input stream #0:1 (audio): 1 packets read (5760 bytes); 
  Total: 9 packets (21749272 bytes) demuxed
Output file #0 (/dev/stdout):
  Output stream #0:0 (video): 3 frames encoded; 3 packets muxed (8294400 bytes); 
  Total: 3 packets (8294400 bytes) muxed
5 frames successfully decoded, 0 decoding errors
[AVIOContext @ 0x3f9fdc0] Statistics: 0 seeks, 1 writeouts
[AVIOContext @ 0x3f97c00] Statistics: 21967408 bytes read, 6 seeks


More information about the ffmpeg-user mailing list