[FFmpeg-user] ffmpeg makes some sources darker

Andy Furniss adf.lists at gmail.com
Tue Jan 5 00:19:37 CET 2016


Jim Worrall wrote:

>> It seems ffmpeg swscale/png honors the 709 for the master.
>>
>> testing -
>>
>> ffmpeg -i in.mkv -vframes 1  frame1-master.png
>>
>> ffmpeg -i in.mkv -vframes 1  -vcodec rawvideo -f rawvideo frame1-master.yuv
>>
>> ffmpeg -f rawvideo -pix_fmt yuv420p -s 1920x1080 -i frame1-master.yuv frame1-yuv.png
>>
>> and frame1-yuv.png is darker than frame1-master.png
>>
>> do
>>
>> ffmpeg -f rawvideo -pix_fmt yuv420p -s 1920x1080 -i frame1-master.yuv -vf scale=in_color_matrix=bt709  frame1-yuv-709.png
>>
>> and frame1-yuv-709.png visually (but not md5sum) matches frame1-master.png
>
> I’m not sure if you’ve already done this, or you’re predicting.
> In any case, you’re not going to like the result.
> frame1-yuv-709.png is actually intermediate in darkness to the other two,
> but closer to frame1-yuv.png.

Strange, unless there is something in the pngs that causes a different 
viewer to produce different output.

I looked again (display from ancient imagemagic) and can't see any 
difference - psnr/ssim agree.

The pngs are not the same md5sum wise

md5sum frame1-yuv-709.png frame1-master.png
1c086ed015ebe05aa1cfc66d9fe754a3  frame1-yuv-709.png
91ab580b1db4361fcceadaffd24930bd  frame1-master.png

below 709 compared to master followed by "default" vs master.

ffmpeg -i frame1-yuv-709.png -i frame1-master.png -lavfi 
"ssim;[0:v][1:v]psnr" -f null -
ffmpeg version N-77624-gf00e12e Copyright (c) 2000-2015 the FFmpeg 
developers
   built with gcc 4.9.2 (GCC)
   configuration: --prefix=/usr --disable-doc --enable-gpl 
--enable-libvpx --enable-libschroedinger --enable-libx265 
--enable-libdcadec --enable-libmp3lame --enable-libfdk-aac 
--enable-nonfree --enable-libx264
   libavutil      55. 12.100 / 55. 12.100
   libavcodec     57. 21.100 / 57. 21.100
   libavformat    57. 21.100 / 57. 21.100
   libavdevice    57.  0.100 / 57.  0.100
   libavfilter     6. 22.100 /  6. 22.100
   libswscale      4.  0.100 /  4.  0.100
   libswresample   2.  0.101 /  2.  0.101
   libpostproc    54.  0.100 / 54.  0.100
Input #0, png_pipe, from 'frame1-yuv-709.png':
   Duration: N/A, bitrate: N/A
     Stream #0:0: Video: png, rgb24(pc), 1920x1080, 25 tbr, 25 tbn, 25 tbc
Input #1, png_pipe, from 'frame1-master.png':
   Duration: N/A, bitrate: N/A
     Stream #1:0: Video: png, rgb24(pc), 1920x1080 [SAR 1:1 DAR 16:9], 
25 tbr, 25 tbn, 25 tbc
Output #0, null, to 'pipe:':
   Metadata:
     encoder         : Lavf57.21.100
     Stream #0:0: Video: wrapped_avframe, gbrp, 1920x1080, q=2-31, 200 
kb/s, 25 fps, 25 tbn, 25 tbc
     Metadata:
       encoder         : Lavc57.21.100 wrapped_avframe
     Stream #0:1: Video: wrapped_avframe, gbrp, 1920x1080, q=2-31, 200 
kb/s, 25 fps, 25 tbn, 25 tbc
     Metadata:
       encoder         : Lavc57.21.100 wrapped_avframe
Stream mapping:
   Stream #0:0 (png) -> ssim:main
   Stream #0:0 (png) -> psnr:main
   Stream #1:0 (png) -> ssim:reference
   Stream #1:0 (png) -> psnr:reference
   ssim -> Stream #0:0 (wrapped_avframe)
   psnr -> Stream #0:1 (wrapped_avframe)
Press [q] to stop, [?] for help
frame=    1 fps=0.0 q=-0.0 Lq=-0.0 size=N/A time=00:00:00.04 bitrate=N/A 
speed=0.201x
video:1kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB 
muxing overhead: unknown
[Parsed_ssim_0 @ 0x1f93340] SSIM R:1.000000 (inf) G:1.000000 (inf) 
B:1.000000 (inf) All:1.000000 (inf)
[Parsed_psnr_1 @ 0x1f9f280] PSNR r:inf g:inf b:inf average:inf min:inf 
max:inf


ffmpeg -i frame1-yuv.png -i frame1-master.png -lavfi 
"ssim;[0:v][1:v]psnr" -f null -
ffmpeg version N-77624-gf00e12e Copyright (c) 2000-2015 the FFmpeg 
developers
   built with gcc 4.9.2 (GCC)
   configuration: --prefix=/usr --disable-doc --enable-gpl 
--enable-libvpx --enable-libschroedinger --enable-libx265 
--enable-libdcadec --enable-libmp3lame --enable-libfdk-aac 
--enable-nonfree --enable-libx264
   libavutil      55. 12.100 / 55. 12.100
   libavcodec     57. 21.100 / 57. 21.100
   libavformat    57. 21.100 / 57. 21.100
   libavdevice    57.  0.100 / 57.  0.100
   libavfilter     6. 22.100 /  6. 22.100
   libswscale      4.  0.100 /  4.  0.100
   libswresample   2.  0.101 /  2.  0.101
   libpostproc    54.  0.100 / 54.  0.100
Input #0, png_pipe, from 'frame1-yuv.png':
   Duration: N/A, bitrate: N/A
     Stream #0:0: Video: png, rgb24(pc), 1920x1080, 25 tbr, 25 tbn, 25 tbc
Input #1, png_pipe, from 'frame1-master.png':
   Duration: N/A, bitrate: N/A
     Stream #1:0: Video: png, rgb24(pc), 1920x1080 [SAR 1:1 DAR 16:9], 
25 tbr, 25 tbn, 25 tbc
Output #0, null, to 'pipe:':
   Metadata:
     encoder         : Lavf57.21.100
     Stream #0:0: Video: wrapped_avframe, gbrp, 1920x1080, q=2-31, 200 
kb/s, 25 fps, 25 tbn, 25 tbc
     Metadata:
       encoder         : Lavc57.21.100 wrapped_avframe
     Stream #0:1: Video: wrapped_avframe, gbrp, 1920x1080, q=2-31, 200 
kb/s, 25 fps, 25 tbn, 25 tbc
     Metadata:
       encoder         : Lavc57.21.100 wrapped_avframe
Stream mapping:
   Stream #0:0 (png) -> ssim:main
   Stream #0:0 (png) -> psnr:main
   Stream #1:0 (png) -> ssim:reference
   Stream #1:0 (png) -> psnr:reference
   ssim -> Stream #0:0 (wrapped_avframe)
   psnr -> Stream #0:1 (wrapped_avframe)
Press [q] to stop, [?] for help
frame=    1 fps=0.0 q=-0.0 Lq=-0.0 size=N/A time=00:00:00.04 bitrate=N/A 
speed=0.224x
video:1kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB 
muxing overhead: unknown
[Parsed_ssim_0 @ 0x20778a0] SSIM R:0.998602 (28.543734) G:0.958310 
(13.799701) B:0.999853 (38.334318) All:0.985588 (18.412869)
[Parsed_psnr_1 @ 0x20781a0] PSNR r:45.156870 g:45.088679 b:51.539840 
average:46.414348 min:46.414348 max:46.414348



More information about the ffmpeg-user mailing list