Opened 7 years ago

Closed 6 years ago

#6839 closed defect (fixed)

transcoding r210 creates a 16 bit rather than 10 bit pixel format

Reported by: dave rice Owned by:
Priority: normal Component: avcodec
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

Summary of the bug:

Create a sample r210 file (r210.mov) with

ffmpeg -f lavfi -i testsrc -c:v r210 -t 1 -y r210.mov
ffmpeg version N-45636-g8329ae781 Copyright (c) 2000-2017 the FFmpeg developers
  built with Apple LLVM version 9.0.0 (clang-900.0.38)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD-8329ae7 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-gpl --enable-ffplay --enable-libfreetype --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --enable-videotoolbox --disable-lzma
  libavutil      56.  0.100 / 56.  0.100
  libavcodec     58.  3.101 / 58.  3.101
  libavformat    58.  2.100 / 58.  2.100
  libavdevice    58.  0.100 / 58.  0.100
  libavfilter     7.  0.101 /  7.  0.101
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  0.101 /  5.  0.101
  libswresample   3.  0.101 /  3.  0.101
  libpostproc    55.  0.100 / 55.  0.100
Input #0, lavfi, from 'testsrc':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: rawvideo (RGB[24] / 0x18424752), rgb24, 320x240 [SAR 1:1 DAR 4:3], 25 tbr, 25 tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> r210 (native))
Press [q] to stop, [?] for help
Output #0, mov, to 'r210.mov':
  Metadata:
    encoder         : Lavf58.2.100
    Stream #0:0: Video: r210 (r210 / 0x30313272), rgb48le, 320x240 [SAR 1:1 DAR 4:3], q=2-31, 61440 kb/s, 25 fps, 12800 tbn, 25 tbc
    Metadata:
      encoder         : Lavc58.3.101 r210
frame=   25 fps=0.0 q=-0.0 Lsize=    7501kB time=00:00:00.96 bitrate=64001.3kbits/s speed=  26x    
video:7500kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.010221%

Transcode to ffv1:

ffmpeg -i r210.mov -c:v ffv1 -y -strict experimental r210_to_ffv1.mov
ffmpeg version N-45636-g8329ae781 Copyright (c) 2000-2017 the FFmpeg developers
  built with Apple LLVM version 9.0.0 (clang-900.0.38)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD-8329ae7 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-gpl --enable-ffplay --enable-libfreetype --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --enable-videotoolbox --disable-lzma
  libavutil      56.  0.100 / 56.  0.100
  libavcodec     58.  3.101 / 58.  3.101
  libavformat    58.  2.100 / 58.  2.100
  libavdevice    58.  0.100 / 58.  0.100
  libavfilter     7.  0.101 /  7.  0.101
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  0.101 /  5.  0.101
  libswresample   3.  0.101 /  3.  0.101
  libpostproc    55.  0.100 / 55.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'r210.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 512
    compatible_brands: qt  
    encoder         : Lavf58.2.100
  Duration: 00:00:01.00, start: 0.000000, bitrate: 61446 kb/s
    Stream #0:0(eng): Video: r210 (r210 / 0x30313272), rgb48le(10 bpc, progressive), 320x240, 61440 kb/s, SAR 1:1 DAR 4:3, 25 fps, 25 tbr, 12800 tbn, 12800 tbc (default)
    Metadata:
      handler_name    : DataHandler
      encoder         : Lavc58.3.101 r210
Stream mapping:
  Stream #0:0 -> #0:0 (r210 (native) -> ffv1 (native))
Press [q] to stop, [?] for help
[ffv1 @ 0x7fc6ee002a00] bits_per_raw_sample > 8, forcing range coder
[mov @ 0x7fc6ee001800] Using MS style video codec tag, the file may be unplayable!
Output #0, mov, to 'r210_to_ffv1.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 512
    compatible_brands: qt  
    encoder         : Lavf58.2.100
    Stream #0:0(eng): Video: ffv1, rgb48le(10 bpc), 320x240 [SAR 1:1 DAR 4:3], q=2-31, 200 kb/s, 25 fps, 12800 tbn, 25 tbc (default)
    Metadata:
      handler_name    : DataHandler
      encoder         : Lavc58.3.101 ffv1
frame=   25 fps=0.0 q=-0.0 Lsize=     112kB time=00:00:00.96 bitrate= 956.8kbits/s speed=12.5x    
video:111kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.762602%

The output is rgb48le (now 16 bit).

I can specify gbrp10le but shouldn't this be the default.
Forcing 10 bit rgb (similar between r210 input and ffv1 output):

ffmpeg -i r210.mov -c:v ffv1 -y -pix_fmt gbrp10le r210_to_ffv1.mov
ffmpeg version N-45636-g8329ae781 Copyright (c) 2000-2017 the FFmpeg developers
  built with Apple LLVM version 9.0.0 (clang-900.0.38)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD-8329ae7 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-gpl --enable-ffplay --enable-libfreetype --enable-libmp3lame --enable-libx264 --enable-libxvid --enable-opencl --enable-videotoolbox --disable-lzma
  libavutil      56.  0.100 / 56.  0.100
  libavcodec     58.  3.101 / 58.  3.101
  libavformat    58.  2.100 / 58.  2.100
  libavdevice    58.  0.100 / 58.  0.100
  libavfilter     7.  0.101 /  7.  0.101
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  0.101 /  5.  0.101
  libswresample   3.  0.101 /  3.  0.101
  libpostproc    55.  0.100 / 55.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'r210.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 512
    compatible_brands: qt  
    encoder         : Lavf58.2.100
  Duration: 00:00:01.00, start: 0.000000, bitrate: 61446 kb/s
    Stream #0:0(eng): Video: r210 (r210 / 0x30313272), rgb48le(10 bpc, progressive), 320x240, 61440 kb/s, SAR 1:1 DAR 4:3, 25 fps, 25 tbr, 12800 tbn, 12800 tbc (default)
    Metadata:
      handler_name    : DataHandler
      encoder         : Lavc58.3.101 r210
Stream mapping:
  Stream #0:0 -> #0:0 (r210 (native) -> ffv1 (native))
Press [q] to stop, [?] for help
[ffv1 @ 0x7fa0df801200] bits_per_raw_sample > 8, forcing range coder
[mov @ 0x7fa0df800000] Using MS style video codec tag, the file may be unplayable!
Output #0, mov, to 'r210_to_ffv1.mov':
  Metadata:
    major_brand     : qt  
    minor_version   : 512
    compatible_brands: qt  
    encoder         : Lavf58.2.100
    Stream #0:0(eng): Video: ffv1, gbrp10le, 320x240 [SAR 1:1 DAR 4:3], q=2-31, 200 kb/s, 25 fps, 12800 tbn, 25 tbc (default)
    Metadata:
      handler_name    : DataHandler
      encoder         : Lavc58.3.101 ffv1
frame=   25 fps=0.0 q=-0.0 Lsize=      86kB time=00:00:00.96 bitrate= 730.3kbits/s speed=12.7x    
video:85kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.001441%

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

Change History (3)

comment:1 by Carl Eugen Hoyos, 7 years ago

Component: avcodecavfilter
Keywords: r210 removed
Reproduced by developer: set
Status: newopen

I believe this is an old and major bug in the avfilter api, I just sent a patch that would allow to fix this issue that was definitely reported before (maybe not on trac though).
Work-around is to force a pix_fmt.

comment:2 by Elon Musk, 6 years ago

Component: avfilteravcodec

This is codec bug and not avfilter.

comment:3 by Elon Musk, 6 years ago

Resolution: fixed
Status: openclosed
Note: See TracTickets for help on using tickets.