Opened 6 years ago

Last modified 12 months ago

#7466 open defect

scaled mjpeg movies from ProRes have lifted black

Reported by: Brendan Bolles Owned by:
Priority: normal Component: undetermined
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug: Get slightly lifted blacks (8-bit RGB value of 1 instead of 0) in the final movie with this particular sequence:

  1. Source is 3840x2304 ProRes 4444 movie
  2. Crop and scale filter is applied: -vf crop=3840:2160,scale=1280x720
  3. Out is saved as an mjpeg movie

Terminal output:

ffmpeg started on 2018-10-02 at 17:08:16
Report written to "ffmpeg-20181002-170816.log"
Command line:
/Volumes/Rodan/Swordfish_Resources/bin/ffmpeg -loglevel verbose -y -report -i /Users/user1/Renders/GB-Master_3840x2304_en_AU/GB-Master_3840x2304_en_AU_v014.mov -vf "crop=3840:2160,scale=1280x720" -c:v mjpeg -q 3 /Users/user1/Renders/GB-Master_3840x2304_en_AU/201809_GeniusBar_en_AU_v014/testing_GB-Master_1280x720_en_AU_v014.mov
ffmpeg version N-92086-gd702769213 Copyright (c) 2000-2018 the FFmpeg developers
  built with Apple LLVM version 10.0.0 (clang-1000.11.45.2)
  configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-appkit --enable-avfoundation --enable-coreimage --enable-audiotoolbox
  libavutil      56. 19.101 / 56. 19.101
  libavcodec     58. 31.102 / 58. 31.102
  libavformat    58. 18.103 / 58. 18.103
  libavdevice    58.  4.105 / 58.  4.105
  libavfilter     7. 33.100 /  7. 33.100
  libswscale      5.  2.100 /  5.  2.100
  libswresample   3.  2.100 /  3.  2.100
  libpostproc    55.  2.100 / 55.  2.100
Splitting the commandline.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'verbose'.
Reading option '-y' ... matched as option 'y' (overwrite output files) with argument '1'.
Reading option '-report' ... matched as option 'report' (generate a report) with argument '1'.
Reading option '-i' ... matched as input url with argument '/Users/user1/Renders/GB-Master_3840x2304_en_AU/GB-Master_3840x2304_en_AU_v014.mov'.
Reading option '-vf' ... matched as option 'vf' (set video filters) with argument 'crop=3840:2160,scale=1280x720'.
Reading option '-c:v' ... matched as option 'c' (codec name) with argument 'mjpeg'.
Reading option '-q' ... matched as option 'q' (use fixed quality scale (VBR)) with argument '3'.
Reading option '/Users/user1/Renders/GB-Master_3840x2304_en_AU/201809_GeniusBar_en_AU_v014/testing_GB-Master_1280x720_en_AU_v014.mov' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set logging level) with argument verbose.
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 /Users/user1/Renders/GB-Master_3840x2304_en_AU/GB-Master_3840x2304_en_AU_v014.mov.
Successfully parsed a group of options.
Opening an input file: /Users/user1/Renders/GB-Master_3840x2304_en_AU/GB-Master_3840x2304_en_AU_v014.mov.
[NULL @ 0x7fa0d6801000] Opening '/Users/user1/Renders/GB-Master_3840x2304_en_AU/GB-Master_3840x2304_en_AU_v014.mov' for reading
[file @ 0x7fa0d5500740] Setting default whitelist 'file,crypto'
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fa0d6801000] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fa0d6801000] ISO: File Type Major Brand: qt  
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fa0d6801000] Unknown dref type 0x206c7275 size 12
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fa0d6801000] Processing st: 0, edit list 0 - media time: 0, duration: 51210
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fa0d6801000] Unknown dref type 0x206c7275 size 12
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fa0d6801000] Processing st: 1, edit list 0 - media time: 0, duration: 51210
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fa0d6801000] Before avformat_find_stream_info() pos: 50258249 bytes read:67617 seeks:3 nb_streams:2
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fa0d6801000] All info found
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fa0d6801000] After avformat_find_stream_info() pos: 298216 bytes read:365797 seeks:4 frames:2
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Users/user1/Renders/GB-Master_3840x2304_en_AU/GB-Master_3840x2304_en_AU_v014.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 512
    compatible_brands: qt  
    encoder         : Lavf58.18.101
  Duration: 00:00:03.33, start: 0.000000, bitrate: 120595 kb/s
    Stream #0:0(eng), 1, 1/15360: Video: prores, 1 reference frame (ap4h / 0x68347061), yuva444p10le(tv, bt709, progressive), 3840x2304, 120614 kb/s, SAR 1:1 DAR 5:3, 30 fps, 30 tbr, 15360 tbn, 15360 tbc (default)
    Metadata:
      handler_name    : Apple Video Media Handler
      encoder         : Apple ProRes 4444
      timecode        : 00:00:00:00
    Stream #0:1(eng), 1, 1/15360: Data: none (tmcd / 0x64636D74), 0 kb/s
    Metadata:
      handler_name    : Apple Video Media Handler
      timecode        : 00:00:00:00
Successfully opened the file.
Parsing a group of options: output url /Users/user1/Renders/GB-Master_3840x2304_en_AU/201809_GeniusBar_en_AU_v014/testing_GB-Master_1280x720_en_AU_v014.mov.
Applying option vf (set video filters) with argument crop=3840:2160,scale=1280x720.
Applying option c:v (codec name) with argument mjpeg.
Applying option q (use fixed quality scale (VBR)) with argument 3.
Successfully parsed a group of options.
Opening an output file: /Users/user1/Renders/GB-Master_3840x2304_en_AU/201809_GeniusBar_en_AU_v014/testing_GB-Master_1280x720_en_AU_v014.mov.
[file @ 0x7fa0d5503a80] Setting default whitelist 'file,crypto'
Successfully opened the file.
detected 24 logical cores
Stream mapping:
  Stream #0:0 -> #0:0 (prores (native) -> mjpeg (native))
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)
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)
[Parsed_crop_0 @ 0x7fa0d5409d80] Setting 'out_w' to value '3840'
[Parsed_crop_0 @ 0x7fa0d5409d80] Setting 'out_h' to value '2160'
[Parsed_scale_1 @ 0x7fa0d5403f40] Setting 'w' to value '1280x720'
[Parsed_scale_1 @ 0x7fa0d5403f40] Setting 'flags' to value 'bicubic'
[Parsed_scale_1 @ 0x7fa0d5403f40] w:1280 h:720 flags:'bicubic' interl:0
[graph 0 input from stream 0:0 @ 0x7fa0d5403280] Setting 'video_size' to value '3840x2304'
[graph 0 input from stream 0:0 @ 0x7fa0d5403280] Setting 'pix_fmt' to value '93'
[graph 0 input from stream 0:0 @ 0x7fa0d5403280] Setting 'time_base' to value '1/15360'
[graph 0 input from stream 0:0 @ 0x7fa0d5403280] Setting 'pixel_aspect' to value '1/1'
[graph 0 input from stream 0:0 @ 0x7fa0d5403280] Setting 'sws_param' to value 'flags=2'
[graph 0 input from stream 0:0 @ 0x7fa0d5403280] Setting 'frame_rate' to value '30/1'
[graph 0 input from stream 0:0 @ 0x7fa0d5403280] w:3840 h:2304 pixfmt:yuva444p10le tb:1/15360 fr:30/1 sar:1/1 sws_param:flags=2
[format @ 0x7fa0d5404200] Setting 'pix_fmts' to value 'yuvj420p|yuvj422p|yuvj444p'
[AVFilterGraph @ 0x7fa0d56229c0] query_formats: 5 queried, 4 merged, 0 already done, 0 delayed
[Parsed_scale_1 @ 0x7fa0d5403f40] picking yuvj444p out of 3 ref:yuva444p10le alpha:1
[Parsed_crop_0 @ 0x7fa0d5409d80] w:3840 h:2304 sar:1/1 -> w:3840 h:2160 sar:1/1
[swscaler @ 0x7fa0d580a800] deprecated pixel format used, make sure you did set range correctly
[Parsed_scale_1 @ 0x7fa0d5403f40] w:3840 h:2160 fmt:yuva444p10le sar:1/1 -> w:1280 h:720 fmt:yuvj444p sar:1/1 flags:0x4
[mjpeg @ 0x7fa0d586fc00] intra_quant_bias = 96 inter_quant_bias = 0
[mjpeg @ 0x7fa0d58e5a00] intra_quant_bias = 96 inter_quant_bias = 0
[mjpeg @ 0x7fa0d5937600] intra_quant_bias = 96 inter_quant_bias = 0
[mjpeg @ 0x7fa0d5989200] intra_quant_bias = 96 inter_quant_bias = 0
[mjpeg @ 0x7fa0d59dae00] intra_quant_bias = 96 inter_quant_bias = 0
[mjpeg @ 0x7fa0d5a2ca00] intra_quant_bias = 96 inter_quant_bias = 0
[mjpeg @ 0x7fa0d5a7e600] intra_quant_bias = 96 inter_quant_bias = 0
[mjpeg @ 0x7fa0d5ad0200] intra_quant_bias = 96 inter_quant_bias = 0
[mjpeg @ 0x7fa0d5b21e00] intra_quant_bias = 96 inter_quant_bias = 0
[mjpeg @ 0x7fa0d5b73a00] intra_quant_bias = 96 inter_quant_bias = 0
[mjpeg @ 0x7fa0d5bc5600] intra_quant_bias = 96 inter_quant_bias = 0
[mjpeg @ 0x7fa0d5c17200] intra_quant_bias = 96 inter_quant_bias = 0
[mjpeg @ 0x7fa0d5c68e00] intra_quant_bias = 96 inter_quant_bias = 0
[mjpeg @ 0x7fa0d5cbaa00] intra_quant_bias = 96 inter_quant_bias = 0
[mjpeg @ 0x7fa0d5d0c600] intra_quant_bias = 96 inter_quant_bias = 0
[mjpeg @ 0x7fa0d5d5e200] intra_quant_bias = 96 inter_quant_bias = 0
[mjpeg @ 0x7fa0d5dafe00] intra_quant_bias = 96 inter_quant_bias = 0
[mjpeg @ 0x7fa0d5e01a00] intra_quant_bias = 96 inter_quant_bias = 0
[mjpeg @ 0x7fa0d5e53600] intra_quant_bias = 96 inter_quant_bias = 0
[mjpeg @ 0x7fa0d5ea5200] intra_quant_bias = 96 inter_quant_bias = 0
[mjpeg @ 0x7fa0d5ef6e00] intra_quant_bias = 96 inter_quant_bias = 0
[mjpeg @ 0x7fa0d5f48a00] intra_quant_bias = 96 inter_quant_bias = 0
[mjpeg @ 0x7fa0d5f9a600] intra_quant_bias = 96 inter_quant_bias = 0
[mjpeg @ 0x7fa0d5fec200] intra_quant_bias = 96 inter_quant_bias = 0
[mjpeg @ 0x7fa0d6813e00] intra_quant_bias = 96 inter_quant_bias = 0
Output #0, mov, to '/Users/user1/Renders/GB-Master_3840x2304_en_AU/201809_GeniusBar_en_AU_v014/testing_GB-Master_1280x720_en_AU_v014.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 512
    compatible_brands: qt  
    encoder         : Lavf58.18.103
    Stream #0:0(eng), 0, 1/15360: Video: mjpeg, 1 reference frame (jpeg / 0x6765706A), yuvj444p(pc), 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 0.03 fps, 15360 tbn, 30 tbc (default)
    Metadata:
      handler_name    : Apple Video Media Handler
      timecode        : 00:00:00:00
      encoder         : Lavc58.31.102 mjpeg
    Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
Clipping frame in rate conversion by 0.000008
cur_dts is invalid (this is harmless if it occurs once at the start per stream)
frame=   11 fps=0.0 q=3.0 size=       0kB time=00:00:00.30 bitrate=   1.1kbits/s speed=0.56x    
frame=   26 fps= 25 q=3.0 size=     512kB time=00:00:00.80 bitrate=5242.9kbits/s speed=0.756x    
frame=   43 fps= 27 q=3.0 size=    1280kB time=00:00:01.36 bitrate=7672.4kbits/s speed=0.866x    
frame=   60 fps= 29 q=3.0 size=    2304kB time=00:00:01.93 bitrate=9762.4kbits/s speed=0.921x    
frame=   77 fps= 29 q=3.0 size=    3328kB time=00:00:02.50 bitrate=10905.0kbits/s speed=0.953x    
frame=   94 fps= 30 q=3.0 size=    4352kB time=00:00:03.06 bitrate=11625.4kbits/s speed=0.979x    
[out_0_0 @ 0x7fa0d5405200] EOF on sink link out_0_0:default.
No more output streams to write to, finishing.
frame=  100 fps= 30 q=3.0 Lsize=    4804kB time=00:00:03.30 bitrate=11925.9kbits/s speed=0.985x    
video:4802kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.037314%
Input file #0 (/Users/user1/Renders/GB-Master_3840x2304_en_AU/GB-Master_3840x2304_en_AU_v014.mov):
  Input stream #0:0 (video): 100 packets read (50256128 bytes); 100 frames decoded; 
  Input stream #0:1 (data): 1 packets read (4 bytes); 
  Total: 101 packets (50256132 bytes) demuxed
Output file #0 (/Users/user1/Renders/GB-Master_3840x2304_en_AU/201809_GeniusBar_en_AU_v014/testing_GB-Master_1280x720_en_AU_v014.mov):
  Output stream #0:0 (video): 100 frames encoded; 100 packets muxed (4917712 bytes); 
  Total: 100 packets (4917712 bytes) muxed
100 frames successfully decoded, 0 decoding errors
[AVIOContext @ 0x7fa0d70000c0] Statistics: 2 seeks, 22 writeouts
[AVIOContext @ 0x7fa0d5500900] Statistics: 50323749 bytes read, 4 seeks

Patches should be submitted to the ffmpeg-devel mailing list and not this bug tracker.

Attachments (1)

short_GB-Master_3840x2304_en_AU_v014.mov (1.2 MB ) - added by Brendan Bolles 6 years ago.
ProRes 444 movie with areas of black (shortened)

Download all attachments as: .zip

Change History (4)

comment:1 by Carl Eugen Hoyos, 6 years ago

Please provide the input sample file.

by Brendan Bolles, 6 years ago

ProRes 444 movie with areas of black (shortened)

comment:2 by Balling, 3 years ago

Status: newopen

Wow, just wow. Apparently on this 12 bit sample:

ffplay -i short_GB-Master_3840x2304_en_AU_v014.mov -vf extractplanes=y

fails!! While

ffmpeg -i short_GB-Master_3840x2304_en_AU_v014.mov -vf extractplanes=y ouput.png

does produce correct 16 (or 4096 since the png that we got is 16 bit Y component only).

Just wonderful. And U and V are 130 and not 128 as they are in ffmpeg, the application. "A" is correct though.

Ah, yeah, the bug is reproducible, it is a problem in Y component.

Workaround is to add "crop=3840:2160,scale=1280x720:flags=bitexact"

What a joke.

Last edited 3 years ago by Balling (previous) (diff)

comment:3 by Balling, 12 months ago

Checked with YUView, so black is 12 bit YUVA 0x100 (256), 0x800, 0x800 (2048) and some value for A (YUView zoom box cannot show A), so yes, this is correct, 2048 is achromatic value for Cb, Cr and 256 for narrow range black Y.

Note: See TracTickets for help on using tickets.