Opened 13 years ago

Closed 12 months ago

#443 closed defect (fixed)

-color_range AVOption appears to do nothing

Reported by: TimNich Owned by:
Priority: normal Component: documentation
Version: git-master Keywords: h264
Cc: Michael Niedermayer Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

according to source -color_range <int> can take the following values:-
"0" auto
"1" 16-235
"2" 0-255

and it functions on encode and decode. However altering the option value appears to make no change to the way media is processed, either on input, or output.

Attached stills sources and script to generate outputs using variations in value attached.

Attachments (3)

bars-601.png (4.1 KB ) - added by TimNich 13 years ago.
16-235 range image
bars-rgb.png (2.2 KB ) - added by TimNich 13 years ago.
full range (0-255) image
still2mov.sh (795 bytes ) - added by TimNich 13 years ago.
script to generate outputs using varying values of -color_range

Download all attachments as: .zip

Change History (16)

by TimNich, 13 years ago

Attachment: bars-601.png added

16-235 range image

by TimNich, 13 years ago

Attachment: bars-rgb.png added

full range (0-255) image

by TimNich, 13 years ago

Attachment: still2mov.sh added

script to generate outputs using varying values of -color_range

comment:1 by TimNich, 13 years ago

Viewing the resultant clips using the waveform monitor in kdenlive shows all 601 source permutations the same, and all rgb permutations the same, with the two batches differing by the level differences in the original file.

comment:2 by llogan, 13 years ago

Is this reproducible with current git head? Also, please show your complete, uncut ffmpeg output.

comment:3 by TimNich, 13 years ago

Still the same with as near current as I can keep up with.:-

> tux-scripts/still2mov.sh bars-rgb.png                                                                                                                                                                     
ffmpeg version N-32542-g3867035-by_Tim, Copyright (c) 2000-2011 the FFmpeg developers                                                                                                                                                        
  built on Sep 13 2011 08:59:23 with gcc 4.5.1 20101208 [gcc-4_5-branch revision 167585]                                                                                                                                                     
  configuration: --prefix=/usr/local --shlibdir=/usr/local/lib64 --libdir=/usr/local/lib64 --mandir=/usr/local/man --incdir=/usr/local/include --extra-version=by_Tim --enable-gpl --enable-nonfree --enable-version3 --enable-pthreads --enable-x11grab --enable-libdc1394 --enable-libvpx --enable-libx264 --enable-libxvid --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libdirac --enable-libschroedinger --enable-libmp3lame --enable-libfaac --enable-libtheora --enable-libvorbis --enable-libfreetype --enable-filter=drawtext --enable-static --disable-shared                                                                                                                                               
  libavutil    51. 16. 0 / 51. 16. 0                                                                                                                                                                                                         
  libavcodec   53. 13. 0 / 53. 13. 0                                                                                                                                                                                                         
  libavformat  53. 12. 0 / 53. 12. 0                                                                                                                                                                                                         
  libavdevice  53.  3. 0 / 53.  3. 0                                                                                                                                                                                                         
  libavfilter   2. 40. 0 /  2. 40. 0                                                                                                                                                                                                         
  libswscale    2.  1. 0 /  2.  1. 0                                                                                                                                                                                                         
  libpostproc  51.  2. 0 / 51.  2. 0                                                                                                                                                                                                         
[image2 @ 0x1317b00] max_analyze_duration 5000000 reached at 5000000                                                                                                                                                                         
Input #0, image2, from 'bars-rgb.png':                                                                                                                                                                                                       
  Duration: 00:00:00.04, start: 0.000000, bitrate: N/A                                                                                                                                                                                       
    Stream #0.0, 127, 1/25: Video: png, rgb24, 720x576, 1/25, 25 fps, 25 tbr, 25 tbn, 25 tbc                                                                                                                                                 
[buffer @ 0x1317a80] w:720 h:576 pixfmt:rgb24 tb:1/1000000 sar:0/1 sws_param:                                                                                                                                                                
[buffersink @ 0x131d360] auto-inserting filter 'auto-inserted scaler 0' between the filter 'src' and the filter 'out'                                                                                                                        
[scale @ 0x1318060] w:720 h:576 fmt:rgb24 -> w:720 h:576 fmt:uyvy422 flags:0x4                                                                                                                                                               
Output #0, avi, to 'bars-rgb.0.avi':                                                                                                                                                                                                         
  Metadata:
    ISFT            : Lavf53.12.0
    Stream #0.0, 0, 1/25: Video: rawvideo (2vuy / 0x79757632), uyvy422, 720x576, 1/25, q=2-31, 200 kb/s, 25 tbn, 25 tbc
Stream mapping:
  Stream #0.0 -> #0.0 (png -> rawvideo)
Press [q] to stop, [?] for help
frame=  125 fps= 39 q=0.0 Lsize=  101258kB time=00:00:05.00 bitrate=165901.9kbits/s    
video:101250kB audio:0kB global headers:0kB muxing overhead 0.008372%
ffmpeg version N-32542-g3867035-by_Tim, Copyright (c) 2000-2011 the FFmpeg developers
  built on Sep 13 2011 08:59:23 with gcc 4.5.1 20101208 [gcc-4_5-branch revision 167585]
  configuration: --prefix=/usr/local --shlibdir=/usr/local/lib64 --libdir=/usr/local/lib64 --mandir=/usr/local/man --incdir=/usr/local/include --extra-version=by_Tim --enable-gpl --enable-nonfree --enable-version3 --enable-pthreads --enable-x11grab --enable-libdc1394 --enable-libvpx --enable-libx264 --enable-libxvid --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libdirac --enable-libschroedinger --enable-libmp3lame --enable-libfaac --enable-libtheora --enable-libvorbis --enable-libfreetype --enable-filter=drawtext --enable-static --disable-shared
  libavutil    51. 16. 0 / 51. 16. 0
  libavcodec   53. 13. 0 / 53. 13. 0
  libavformat  53. 12. 0 / 53. 12. 0
  libavdevice  53.  3. 0 / 53.  3. 0
  libavfilter   2. 40. 0 /  2. 40. 0
  libswscale    2.  1. 0 /  2.  1. 0
  libpostproc  51.  2. 0 / 51.  2. 0
[image2 @ 0x1317cc0] max_analyze_duration 5000000 reached at 5000000
Input #0, image2, from 'bars-rgb.png':                                                                                                                                                                                                       
  Duration: 00:00:00.04, start: 0.000000, bitrate: N/A
    Stream #0.0, 127, 1/25: Video: png, rgb24, 720x576, 1/25, 25 fps, 25 tbr, 25 tbn, 25 tbc
[buffer @ 0x1317b60] w:720 h:576 pixfmt:rgb24 tb:1/1000000 sar:0/1 sws_param:
[buffersink @ 0x131d740] auto-inserting filter 'auto-inserted scaler 0' between the filter 'src' and the filter 'out'
[scale @ 0x131b1a0] w:720 h:576 fmt:rgb24 -> w:720 h:576 fmt:uyvy422 flags:0x4
Output #0, avi, to '0.bars-rgb.avi':
  Metadata:
    ISFT            : Lavf53.12.0
    Stream #0.0, 0, 1/25: Video: rawvideo (2vuy / 0x79757632), uyvy422, 720x576, 1/25, q=2-31, 200 kb/s, 25 tbn, 25 tbc
Stream mapping:
  Stream #0.0 -> #0.0 (png -> rawvideo)
Press [q] to stop, [?] for help
frame=  125 fps= 37 q=0.0 Lsize=  101258kB time=00:00:05.00 bitrate=165901.9kbits/s    
video:101250kB audio:0kB global headers:0kB muxing overhead 0.008372%
ffmpeg version N-32542-g3867035-by_Tim, Copyright (c) 2000-2011 the FFmpeg developers
  built on Sep 13 2011 08:59:23 with gcc 4.5.1 20101208 [gcc-4_5-branch revision 167585]
  configuration: --prefix=/usr/local --shlibdir=/usr/local/lib64 --libdir=/usr/local/lib64 --mandir=/usr/local/man --incdir=/usr/local/include --extra-version=by_Tim --enable-gpl --enable-nonfree --enable-version3 --enable-pthreads --enable-x11grab --enable-libdc1394 --enable-libvpx --enable-libx264 --enable-libxvid --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libdirac --enable-libschroedinger --enable-libmp3lame --enable-libfaac --enable-libtheora --enable-libvorbis --enable-libfreetype --enable-filter=drawtext --enable-static --disable-shared
  libavutil    51. 16. 0 / 51. 16. 0
  libavcodec   53. 13. 0 / 53. 13. 0
  libavformat  53. 12. 0 / 53. 12. 0
  libavdevice  53.  3. 0 / 53.  3. 0
  libavfilter   2. 40. 0 /  2. 40. 0
  libswscale    2.  1. 0 /  2.  1. 0
  libpostproc  51.  2. 0 / 51.  2. 0
[image2 @ 0x1317b00] max_analyze_duration 5000000 reached at 5000000
Input #0, image2, from 'bars-rgb.png':                                                                                                                                                                                                       
  Duration: 00:00:00.04, start: 0.000000, bitrate: N/A
    Stream #0.0, 127, 1/25: Video: png, rgb24, 720x576, 1/25, 25 fps, 25 tbr, 25 tbn, 25 tbc
[buffer @ 0x1317a80] w:720 h:576 pixfmt:rgb24 tb:1/1000000 sar:0/1 sws_param:
[buffersink @ 0x131d360] auto-inserting filter 'auto-inserted scaler 0' between the filter 'src' and the filter 'out'
[scale @ 0x1318060] w:720 h:576 fmt:rgb24 -> w:720 h:576 fmt:uyvy422 flags:0x4
Output #0, avi, to 'bars-rgb.1.avi':
  Metadata:
    ISFT            : Lavf53.12.0
    Stream #0.0, 0, 1/25: Video: rawvideo (2vuy / 0x79757632), uyvy422, 720x576, 1/25, q=2-31, 200 kb/s, 25 tbn, 25 tbc
Stream mapping:
  Stream #0.0 -> #0.0 (png -> rawvideo)
Press [q] to stop, [?] for help
frame=  125 fps= 40 q=0.0 Lsize=  101258kB time=00:00:05.00 bitrate=165901.9kbits/s    
video:101250kB audio:0kB global headers:0kB muxing overhead 0.008372%
ffmpeg version N-32542-g3867035-by_Tim, Copyright (c) 2000-2011 the FFmpeg developers
  built on Sep 13 2011 08:59:23 with gcc 4.5.1 20101208 [gcc-4_5-branch revision 167585]
  configuration: --prefix=/usr/local --shlibdir=/usr/local/lib64 --libdir=/usr/local/lib64 --mandir=/usr/local/man --incdir=/usr/local/include --extra-version=by_Tim --enable-gpl --enable-nonfree --enable-version3 --enable-pthreads --enable-x11grab --enable-libdc1394 --enable-libvpx --enable-libx264 --enable-libxvid --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libdirac --enable-libschroedinger --enable-libmp3lame --enable-libfaac --enable-libtheora --enable-libvorbis --enable-libfreetype --enable-filter=drawtext --enable-static --disable-shared
  libavutil    51. 16. 0 / 51. 16. 0
  libavcodec   53. 13. 0 / 53. 13. 0
  libavformat  53. 12. 0 / 53. 12. 0
  libavdevice  53.  3. 0 / 53.  3. 0
  libavfilter   2. 40. 0 /  2. 40. 0
  libswscale    2.  1. 0 /  2.  1. 0
  libpostproc  51.  2. 0 / 51.  2. 0
[image2 @ 0x1317cc0] max_analyze_duration 5000000 reached at 5000000
Input #0, image2, from 'bars-rgb.png':                                                                                                                                                                                                       
  Duration: 00:00:00.04, start: 0.000000, bitrate: N/A
    Stream #0.0, 127, 1/25: Video: png, rgb24, 720x576, 1/25, 25 fps, 25 tbr, 25 tbn, 25 tbc
[buffer @ 0x1317b60] w:720 h:576 pixfmt:rgb24 tb:1/1000000 sar:0/1 sws_param:
[buffersink @ 0x131d740] auto-inserting filter 'auto-inserted scaler 0' between the filter 'src' and the filter 'out'
[scale @ 0x131b1a0] w:720 h:576 fmt:rgb24 -> w:720 h:576 fmt:uyvy422 flags:0x4
Output #0, avi, to '1.bars-rgb.avi':
  Metadata:
    ISFT            : Lavf53.12.0
    Stream #0.0, 0, 1/25: Video: rawvideo (2vuy / 0x79757632), uyvy422, 720x576, 1/25, q=2-31, 200 kb/s, 25 tbn, 25 tbc
Stream mapping:
  Stream #0.0 -> #0.0 (png -> rawvideo)
Press [q] to stop, [?] for help
frame=  125 fps= 40 q=0.0 Lsize=  101258kB time=00:00:05.00 bitrate=165901.9kbits/s    
video:101250kB audio:0kB global headers:0kB muxing overhead 0.008372%
ffmpeg version N-32542-g3867035-by_Tim, Copyright (c) 2000-2011 the FFmpeg developers
  built on Sep 13 2011 08:59:23 with gcc 4.5.1 20101208 [gcc-4_5-branch revision 167585]
  configuration: --prefix=/usr/local --shlibdir=/usr/local/lib64 --libdir=/usr/local/lib64 --mandir=/usr/local/man --incdir=/usr/local/include --extra-version=by_Tim --enable-gpl --enable-nonfree --enable-version3 --enable-pthreads --enable-x11grab --enable-libdc1394 --enable-libvpx --enable-libx264 --enable-libxvid --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libdirac --enable-libschroedinger --enable-libmp3lame --enable-libfaac --enable-libtheora --enable-libvorbis --enable-libfreetype --enable-filter=drawtext --enable-static --disable-shared
  libavutil    51. 16. 0 / 51. 16. 0
  libavcodec   53. 13. 0 / 53. 13. 0
  libavformat  53. 12. 0 / 53. 12. 0
  libavdevice  53.  3. 0 / 53.  3. 0
  libavfilter   2. 40. 0 /  2. 40. 0
  libswscale    2.  1. 0 /  2.  1. 0
  libpostproc  51.  2. 0 / 51.  2. 0
[image2 @ 0x1317b00] max_analyze_duration 5000000 reached at 5000000
Input #0, image2, from 'bars-rgb.png':                                                                                                                                                                                                       
  Duration: 00:00:00.04, start: 0.000000, bitrate: N/A
    Stream #0.0, 127, 1/25: Video: png, rgb24, 720x576, 1/25, 25 fps, 25 tbr, 25 tbn, 25 tbc
[buffer @ 0x1317a80] w:720 h:576 pixfmt:rgb24 tb:1/1000000 sar:0/1 sws_param:
[buffersink @ 0x131d360] auto-inserting filter 'auto-inserted scaler 0' between the filter 'src' and the filter 'out'
[scale @ 0x1318060] w:720 h:576 fmt:rgb24 -> w:720 h:576 fmt:uyvy422 flags:0x4
Output #0, avi, to 'bars-rgb.2.avi':
  Metadata:
    ISFT            : Lavf53.12.0
    Stream #0.0, 0, 1/25: Video: rawvideo (2vuy / 0x79757632), uyvy422, 720x576, 1/25, q=2-31, 200 kb/s, 25 tbn, 25 tbc
Stream mapping:
  Stream #0.0 -> #0.0 (png -> rawvideo)
Press [q] to stop, [?] for help
frame=  125 fps= 37 q=0.0 Lsize=  101258kB time=00:00:05.00 bitrate=165901.9kbits/s    
video:101250kB audio:0kB global headers:0kB muxing overhead 0.008372%
ffmpeg version N-32542-g3867035-by_Tim, Copyright (c) 2000-2011 the FFmpeg developers
  built on Sep 13 2011 08:59:23 with gcc 4.5.1 20101208 [gcc-4_5-branch revision 167585]
  configuration: --prefix=/usr/local --shlibdir=/usr/local/lib64 --libdir=/usr/local/lib64 --mandir=/usr/local/man --incdir=/usr/local/include --extra-version=by_Tim --enable-gpl --enable-nonfree --enable-version3 --enable-pthreads --enable-x11grab --enable-libdc1394 --enable-libvpx --enable-libx264 --enable-libxvid --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libdirac --enable-libschroedinger --enable-libmp3lame --enable-libfaac --enable-libtheora --enable-libvorbis --enable-libfreetype --enable-filter=drawtext --enable-static --disable-shared
  libavutil    51. 16. 0 / 51. 16. 0
  libavcodec   53. 13. 0 / 53. 13. 0
  libavformat  53. 12. 0 / 53. 12. 0
  libavdevice  53.  3. 0 / 53.  3. 0
  libavfilter   2. 40. 0 /  2. 40. 0
  libswscale    2.  1. 0 /  2.  1. 0
  libpostproc  51.  2. 0 / 51.  2. 0
[image2 @ 0x1317cc0] max_analyze_duration 5000000 reached at 5000000
Input #0, image2, from 'bars-rgb.png':                                                                                                                                                                                                       
  Duration: 00:00:00.04, start: 0.000000, bitrate: N/A
    Stream #0.0, 127, 1/25: Video: png, rgb24, 720x576, 1/25, 25 fps, 25 tbr, 25 tbn, 25 tbc
[buffer @ 0x1317b60] w:720 h:576 pixfmt:rgb24 tb:1/1000000 sar:0/1 sws_param:
[buffersink @ 0x131d740] auto-inserting filter 'auto-inserted scaler 0' between the filter 'src' and the filter 'out'
[scale @ 0x131b1a0] w:720 h:576 fmt:rgb24 -> w:720 h:576 fmt:uyvy422 flags:0x4
Output #0, avi, to '2.bars-rgb.avi':
  Metadata:
    ISFT            : Lavf53.12.0
    Stream #0.0, 0, 1/25: Video: rawvideo (2vuy / 0x79757632), uyvy422, 720x576, 1/25, q=2-31, 200 kb/s, 25 tbn, 25 tbc
Stream mapping:
  Stream #0.0 -> #0.0 (png -> rawvideo)
Press [q] to stop, [?] for help
frame=  125 fps= 40 q=0.0 Lsize=  101258kB time=00:00:05.00 bitrate=165901.9kbits/s    
video:101250kB audio:0kB global headers:0kB muxing overhead 0.008372
Last edited 12 years ago by TimNich (previous) (diff)

comment:4 by Carl Eugen Hoyos, 11 years ago

Keywords: h264 added
Status: newopen
Version: gitgit-master

color_range is an input option that allows you to force a colour range for h264 input.

Unfortunately, this is not what the documentation of the field in avcodec.h explains...
I am not sure if this a documentation bug or if the h264 decoder has a problem.

in reply to:  4 ; comment:5 by TimNich, 11 years ago

Replying to cehoyos:

color_range is an input option that allows you to force a colour range for h264 input.

Unfortunately, this is not what the documentation of the field in avcodec.h explains...
I am not sure if this a documentation bug or if the h264 decoder has a problem.

Well if its only an input option for H264 material it may only be a documentation bug as this is not how I tested it it! (Being in avcodec.h and with the current documentation it appeared to have a wider scope so I tried with non H264 source and also on output)

Is this limitation to H264 input something you just happened to know, or is it documented elsewhere?

in reply to:  5 ; comment:6 by Carl Eugen Hoyos, 11 years ago

Replying to nichot20:

Is this limitation to H264 input something you just happened to know, or is it documented elsewhere?

Neither.
I searched the source for an actual use case;-)

in reply to:  6 comment:7 by TimNich, 11 years ago

Replying to cehoyos:

Replying to nichot20:

Is this limitation to H264 input something you just happened to know, or is it documented elsewhere?

Neither.
I searched the source for an actual use case;-)

It would be good if it were of wider application, but in the meantime a documentation patch would help remove unwarranted expectations.

comment:8 by Elon Musk, 11 years ago

Component: undetermineddocumentation

This option needs clarification.

comment:9 by Michael Niedermayer, 9 years ago

Cc: Michael Niedermayer added

comment:10 by Balling, 3 years ago

This is just metadata. There are a lot of ways to set range besides VUI.

comment:11 by Balling, 22 months ago

In fact as output option it does work:

ffmpeg.exe -i 49996_PID_1015.265 -map 0:v:0 -frames:v 1 -cpu-used 0 -crf 0 -color_range 2 dqewdq1212.avif

will create otherwise bitperfect file (2 bytes difference of range metadata) with full range even though the input is limited.

Same DOES not happen with input option.

comment:13 by Stefano Sabatini, 12 months ago

Resolution: fixed
Status: openclosed

Should be fixed in commit 26eb3129df.

Note: See TracTickets for help on using tickets.