Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#5108 closed defect (invalid)

png -> webm produces video with colors larger and offset

Reported by: petrelharp Owned by:
Priority: normal Component: ffmpeg
Version: git-master Keywords: libvpx
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Converting pngs to webm produces video where everything that's in color is about twice as big as it should be, and about in the right place for a video that's twice as big; something like a K channel (as in CMYK) shows up in the right place. Conversion in the same way to mp4 does not have this problem. This bug wasn't present in v2.6.1, but is present in git/master, as well as in 2.8.4, the version current in debian/sid.

How to reproduce:

/home/peter/software/ffmpeg/bin/ffmpeg -report -y -r 10 -i "test_animate-%d.png" test.webm
ffmpeg version N-77535-g9f4c7b4 Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 5.3.1 (Debian 5.3.1-3) 20151207
  configuration: --prefix=/home/peter/software/ffmpeg/build --pkg-config-flags=--static --extra-cflags=-I/home/peter/software/ffmpeg/build/include --extra-ldflags=-L/home/peter/software/ffmpeg/build/lib --bindir=/home/peter/software/ffmpeg/bin --enable-gpl --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libx264 --enable-nonfree --enable-libvpx
  libavutil      55. 11.100 / 55. 11.100
  libavcodec     57. 20.100 / 57. 20.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
Splitting the commandline.
Reading option '-report' ... matched as option 'report' (generate a report) with argument '1'.
Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'.
Reading option '-r' ... matched as option 'r' (set frame rate (Hz value, fraction or abbreviation)) with argument '10'.
Reading option '-i' ... matched as input file with argument 'test_animate-%d.png'.
Reading option 'test.webm' ... matched as output file.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option report (generate a report) with argument 1.
Applying option y (overwrite output files) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input file test_animate-%d.png.
Applying option r (set frame rate (Hz value, fraction or abbreviation)) with argument 10.
Successfully parsed a group of options.
Opening an input file: test_animate-%d.png.
[AVIOContext @ 0x3483860] Statistics: 13196 bytes read, 0 seeks
[AVIOContext @ 0x3483500] Statistics: 13385 bytes read, 0 seeks
[AVIOContext @ 0x34835a0] Statistics: 13410 bytes read, 0 seeks
[AVIOContext @ 0x3484b20] Statistics: 13261 bytes read, 0 seeks
[AVIOContext @ 0x3484c40] Statistics: 13375 bytes read, 0 seeks
[AVIOContext @ 0x3484b20] Statistics: 13312 bytes read, 0 seeks
[AVIOContext @ 0x3484d00] Statistics: 13321 bytes read, 0 seeks
[AVIOContext @ 0x3484ee0] Statistics: 13464 bytes read, 0 seeks
[AVIOContext @ 0x3485040] Statistics: 13365 bytes read, 0 seeks
Input #0, image2, from 'test_animate-%d.png':
  Duration: 00:00:00.36, start: 0.000000, bitrate: N/A
    Stream #0:0, 9, 1/25: Video: png, rgb24(pc), 504x504 [SAR 2834:2834 DAR 1:1], 25 fps, 25 tbr, 25 tbn, 25 tbc
Successfully opened the file.
Parsing a group of options: output file test.webm.
Successfully parsed a group of options.
Opening an output file: test.webm.
Successfully opened the file.
detected 8 logical cores
[graph 0 input from stream 0:0 @ 0x3486fa0] Setting 'video_size' to value '504x504'
[graph 0 input from stream 0:0 @ 0x3486fa0] Setting 'pix_fmt' to value '2'
[graph 0 input from stream 0:0 @ 0x3486fa0] Setting 'time_base' to value '1/10'
[graph 0 input from stream 0:0 @ 0x3486fa0] Setting 'pixel_aspect' to value '2834/2834'
[graph 0 input from stream 0:0 @ 0x3486fa0] Setting 'sws_param' to value 'flags=2'
[graph 0 input from stream 0:0 @ 0x3486fa0] Setting 'frame_rate' to value '10/1'
[graph 0 input from stream 0:0 @ 0x3486fa0] w:504 h:504 pixfmt:rgb24 tb:1/10 fr:10/1 sar:2834/2834 sws_param:flags=2
[force CFR for input from stream 0:0 @ 0x348c460] Setting 'expr' to value 'N'
[format @ 0x348c260] compat: called with args=[yuv420p|yuv422p|yuv440p|yuv444p]
[format @ 0x348c260] Setting 'pix_fmts' to value 'yuv420p|yuv422p|yuv440p|yuv444p'
[auto-inserted scaler 0 @ 0x3498720] Setting 'flags' to value 'bicubic'
[auto-inserted scaler 0 @ 0x3498720] w:iw h:ih flags:'bicubic' interl:0
[format @ 0x348c260] auto-inserting filter 'auto-inserted scaler 0' between the filter 'Parsed_null_0' and the filter 'format'
[AVFilterGraph @ 0x3482d60] query_formats: 5 queried, 3 merged, 1 already done, 0 delayed
[auto-inserted scaler 0 @ 0x3498720] picking yuv444p out of 4 ref:rgb24 alpha:0
[graph 0 input from stream 0:0 @ 0x3486fa0] TB:0.100000 FRAME_RATE:10.000000 SAMPLE_RATE:nan
[auto-inserted scaler 0 @ 0x3498720] w:504 h:504 fmt:rgb24 sar:2834/2834 -> w:504 h:504 fmt:yuv444p sar:1/1 flags:0x4
[libvpx-vp9 @ 0x3486740] v1.5.0
[libvpx-vp9 @ 0x3486740] --prefix=/usr --enable-pic --enable-shared --disable-install-bins --disable-install-srcs --size-limit=16384x16384 --enable-postproc --enable-multi-res-encoding --enable-temporal-denoising --enable-vp9-temporal-denoising --enable-vp9-postproc --target=x86_64-linux-gcc
[libvpx-vp9 @ 0x3486740] vpx_codec_enc_cfg
[libvpx-vp9 @ 0x3486740] generic settings
  g_usage:                      0
  g_threads:                    8
  g_profile:                    1
  g_w:                          320
  g_h:                          240
  g_bit_depth:                  8
  g_input_bit_depth:            8
  g_timebase:                   {1/30}
  g_error_resilient:            0
  g_pass:                       0
  g_lag_in_frames:              25
[libvpx-vp9 @ 0x3486740] rate control settings
  rc_dropframe_thresh:          0
  rc_resize_allowed:            0
  rc_resize_up_thresh:          60
  rc_resize_down_thresh:        30
  rc_end_usage:                 0
  rc_twopass_stats_in:          (nil)(0)
  rc_target_bitrate:            256
[libvpx-vp9 @ 0x3486740] quantizer settings
  rc_min_quantizer:             0
  rc_max_quantizer:             63
[libvpx-vp9 @ 0x3486740] bitrate tolerance
  rc_undershoot_pct:            25
  rc_overshoot_pct:             25
[libvpx-vp9 @ 0x3486740] decoder buffer model
  rc_buf_sz:                    6000
  rc_buf_initial_sz:            4000
  rc_buf_optimal_sz:            5000
[libvpx-vp9 @ 0x3486740] 2 pass rate control settings
  rc_2pass_vbr_bias_pct:        50
  rc_2pass_vbr_minsection_pct:  0
  rc_2pass_vbr_maxsection_pct:  2000
[libvpx-vp9 @ 0x3486740] keyframing settings
  kf_mode:                      1
  kf_min_dist:                  0
  kf_max_dist:                  9999
[libvpx-vp9 @ 0x3486740] 
[libvpx-vp9 @ 0x3486740] vpx_codec_enc_cfg
[libvpx-vp9 @ 0x3486740] generic settings
  g_usage:                      0
  g_threads:                    0
  g_profile:                    1
  g_w:                          504
  g_h:                          504
  g_bit_depth:                  8
  g_input_bit_depth:            8
  g_timebase:                   {1/10}
  g_error_resilient:            0
  g_pass:                       0
  g_lag_in_frames:              25
[libvpx-vp9 @ 0x3486740] rate control settings
  rc_dropframe_thresh:          0
  rc_resize_allowed:            0
  rc_resize_up_thresh:          60
  rc_resize_down_thresh:        30
  rc_end_usage:                 0
  rc_twopass_stats_in:          (nil)(0)
  rc_target_bitrate:            200
[libvpx-vp9 @ 0x3486740] quantizer settings
  rc_min_quantizer:             0
  rc_max_quantizer:             63
[libvpx-vp9 @ 0x3486740] bitrate tolerance
  rc_undershoot_pct:            25
  rc_overshoot_pct:             25
[libvpx-vp9 @ 0x3486740] decoder buffer model
  rc_buf_sz:                    6000
  rc_buf_initial_sz:            4000
  rc_buf_optimal_sz:            5000
[libvpx-vp9 @ 0x3486740] 2 pass rate control settings
  rc_2pass_vbr_bias_pct:        50
  rc_2pass_vbr_minsection_pct:  0
  rc_2pass_vbr_maxsection_pct:  2000
[libvpx-vp9 @ 0x3486740] keyframing settings
  kf_mode:                      1
  kf_min_dist:                  0
  kf_max_dist:                  9999
[libvpx-vp9 @ 0x3486740] 
[libvpx-vp9 @ 0x3486740] vpx_codec_control
[libvpx-vp9 @ 0x3486740]   VP8E_SET_CPUUSED:             1
[libvpx-vp9 @ 0x3486740]   VP8E_SET_ARNR_MAXFRAMES:      0
[libvpx-vp9 @ 0x3486740]   VP8E_SET_ARNR_STRENGTH:       3
[libvpx-vp9 @ 0x3486740]   VP8E_SET_ARNR_TYPE:           3
[libvpx-vp9 @ 0x3486740]   VP8E_SET_STATIC_THRESHOLD:    0
[libvpx-vp9 @ 0x3486740]   VP9E_SET_COLOR_SPACE:         0
[libvpx-vp9 @ 0x3486740] Using deadline: 1000000
Output #0, webm, to 'test.webm':
  Metadata:
    encoder         : Lavf57.21.100
    Stream #0:0, 0, 1/1000: Video: vp9 (libvpx-vp9), yuv444p, 504x504 [SAR 1:1 DAR 1:1], q=-1--1, 200 kb/s, 10 fps, 1k tbn, 10 tbc
    Metadata:
      encoder         : Lavc57.20.100 libvpx-vp9
    Side data:
      unknown side data type 10 (24 bytes)
Stream mapping:
  Stream #0:0 -> #0:0 (png (native) -> vp9 (libvpx-vp9))
Press [q] to stop, [?] for help
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
Clipping frame in rate conversion by 0.000008
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
[output stream 0:0 @ 0x348bae0] EOF on sink link output stream 0:0:default.
No more output streams to write to, finishing.
[webm @ 0x3485300] Writing block at offset 457, size 8701, pts 0, dts 0, duration 100, keyframe 1
[webm @ 0x3485300] Writing block at offset 9165, size 8644, pts 100, dts 100, duration 100, keyframe 0
[webm @ 0x3485300] Writing block at offset 17816, size 460, pts 200, dts 200, duration 100, keyframe 0
[webm @ 0x3485300] Writing block at offset 18283, size 603, pts 300, dts 300, duration 100, keyframe 0
[webm @ 0x3485300] Writing block at offset 18893, size 605, pts 400, dts 400, duration 100, keyframe 0
[webm @ 0x3485300] Writing block at offset 19505, size 550, pts 500, dts 500, duration 100, keyframe 0
[webm @ 0x3485300] Writing block at offset 20062, size 29, pts 600, dts 600, duration 100, keyframe 0
[webm @ 0x3485300] Writing block at offset 20097, size 593, pts 700, dts 700, duration 100, keyframe 0
[webm @ 0x3485300] Writing block at offset 20697, size 614, pts 800, dts 800, duration 100, keyframe 0
[webm @ 0x3485300] end duration = 900
[webm @ 0x3485300] stream 0 end duration = 900
frame=    9 fps=0.0 q=0.0 Lsize=      21kB time=00:00:00.90 bitrate= 189.8kbits/s speed=1.41x    
video:20kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 2.634742%
Input file #0 (test_animate-%d.png):
  Input stream #0:0 (video): 9 packets read (120089 bytes); 9 frames decoded; 
  Total: 9 packets (120089 bytes) demuxed
Output file #0 (test.webm):
  Output stream #0:0 (video): 9 frames encoded; 9 packets muxed (20799 bytes); 
  Total: 9 packets (20799 bytes) muxed
9 frames successfully decoded, 0 decoding errors
[AVIOContext @ 0x3486e80] Statistics: 22 seeks, 25 writeouts

Attachments (5)

test_animate-1.png (12.9 KB) - added by petrelharp 4 years ago.
png files for the example
test_animate-2.png (13.1 KB) - added by petrelharp 4 years ago.
test_animate-3.png (13.1 KB) - added by petrelharp 4 years ago.
offset-colors.webm (20.8 KB) - added by petrelharp 4 years ago.
output video
screenshot-offset-colors.png (64.9 KB) - added by petrelharp 4 years ago.
screenshot of offset-colors.webm on firefox

Download all attachments as: .zip

Change History (7)

Changed 4 years ago by petrelharp

png files for the example

Changed 4 years ago by petrelharp

Changed 4 years ago by petrelharp

comment:1 Changed 4 years ago by cehoyos

  • Keywords libvpx added; webm removed
  • Resolution set to invalid
  • Status changed from new to closed

Why do you think there is a bug? Newer libvpx supports more colour spaces and FFmpeg tries to looses as little information of your RGB input as possible since you didn't tell it otherwise. If you want yuv420p output add an appropriate option.

Changed 4 years ago by petrelharp

output video

Changed 4 years ago by petrelharp

screenshot of offset-colors.webm on firefox

comment:2 Changed 4 years ago by petrelharp

It's clearly a bug *somewhere*. I've attached the video produced and a screenshot. But, it turns out there isn't a problem when viewing the video in Chrome; only in Firefox, so maybe the problem is there.

*Something* in ffmpeg changed, since videos produced with earlier versions of ffmpeg displayed fine in Firefox.

[... more testing...]

And, it turns out that it's only a problem in Firefox 38; Firefox 42 displays it fine. Never mind.

Note: See TracTickets for help on using tickets.