Opened 10 years ago

Closed 8 years ago

#3343 closed enhancement (fixed)

Support 9-16 bit pixel formats in vf_pad

Reported by: abc123 Owned by:
Priority: wish Component: avfilter
Version: git-master Keywords: pad bounty
Cc: Andrey Utkin Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

Summary of the bug:
libavfilter drawutils does not support bit depths other than 8, as remarked in the code:

int ff_draw_init(FFDrawContext *draw, enum AVPixelFormat format, unsigned flags)
{
...
        /* for now, only 8-bits formats */
        if (c->depth_minus1 != 8 - 1)
            return AVERROR(ENOSYS);
...
}

Since vf_pad is implemented using drawutils, it is not possible to pad 10-bit images such as DPX.

How to reproduce:

% ffmpeg -v debug -i my10bitfile.xxx -vf pad=x:x:x:x -f rawvideo /dev/null
ffmpeg version 2.1.2 Copyright (c) 2000-2013 the FFmpeg developers
  built on Jan 17 2014 14:49:11 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
  configuration: --disable-doc --arch=x86 --target-os=linux --enable-runtime-cpudetect --disable-ffserver --disable-ffplay --disable-avdevice --disable-static --enable-shared --enable-libx264 --enable-libvorbis --enable-libfreetype --enable-libopenjpeg --enable-gpl --enable-nonfree
  libavutil      52. 48.101 / 52. 48.101
  libavcodec     55. 39.101 / 55. 39.101
  libavformat    55. 19.104 / 55. 19.104
  libavfilter     3. 90.100 /  3. 90.100
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
  libpostproc    52.  3.100 / 52.  3.100
Splitting the commandline.
Reading option '-v' ... matched as option 'v' (set logging level) with argument 'debug'.
Reading option '-i' ... matched as input file with argument '1015623_23976_4096_2160_primary_77011_000001.dpx'.
Reading option '-vf' ... matched as option 'vf' (set video filters) with argument 'pad=5120:2160:0:0'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'rawvideo'.
Reading option '/dev/null' ... matched as output file.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set logging level) with argument debug.
Successfully parsed a group of options.
Parsing a group of options: input file 1.dpx.
Successfully parsed a group of options.
Opening an input file: 1.dpx.
[AVIOContext @ 0x89bc040] Statistics: 35391488 bytes read, 0 seeks
[image2 @ 0x89bad80] Probe buffer size limit of 5000000 bytes reached
Input #0, image2, from '1.dpx':
  Duration: 00:00:00.04, start: 0.000000, bitrate: N/A
    Stream #0:0, 1, 1/25: Video: dpx, gbrp10le, 4096x2160, 1/25, 25 tbr, 25 tbn, 25 tbc
Successfully opened the file.
Parsing a group of options: output file /dev/null.
Applying option vf (set video filters) with argument pad=5120:2160:0:0.
Applying option f (force format) with argument rawvideo.
Successfully parsed a group of options.
Opening an output file: /dev/null.
File '/dev/null' already exists. Overwrite ? [y/N] y
Successfully opened the file.
detected 4 logical cores
[Parsed_pad_0 @ 0x89a95c0] Setting 'width' to value '5120'
[Parsed_pad_0 @ 0x89a95c0] Setting 'height' to value '2160'
[Parsed_pad_0 @ 0x89a95c0] Setting 'x' to value '0'
[Parsed_pad_0 @ 0x89a95c0] Setting 'y' to value '0'
[graph 0 input from stream 0:0 @ 0x89a9940] Setting 'video_size' to value '4096x2160'
[graph 0 input from stream 0:0 @ 0x89a9940] Setting 'pix_fmt' to value '86'
[graph 0 input from stream 0:0 @ 0x89a9940] Setting 'time_base' to value '1/25'
[graph 0 input from stream 0:0 @ 0x89a9940] Setting 'pixel_aspect' to value '0/1'
[graph 0 input from stream 0:0 @ 0x89a9940] Setting 'sws_param' to value 'flags=2'
[graph 0 input from stream 0:0 @ 0x89a9940] Setting 'frame_rate' to value '25/1'
[graph 0 input from stream 0:0 @ 0x89a9940] w:4096 h:2160 pixfmt:gbrp10le tb:1/25 fr:25/1 sar:0/1 sws_param:flags=2
[auto-inserted scaler 0 @ 0x89aa3e0] Setting 'flags' to value '0x4'
[auto-inserted scaler 0 @ 0x89aa3e0] w:iw h:ih flags:'0x4' interl:0
-> [Parsed_pad_0 @ 0x89a95c0] auto-inserting filter 'auto-inserted scaler 0' between the filter 'graph 0 input from stream 0:0' and the filter 'Parsed_pad_0'
-> [AVFilterGraph @ 0x89a9080] query_formats: 3 queried, 1 merged, 1 already done, 0 delayed
-> [auto-inserted scaler 0 @ 0x89aa3e0] picking rgb24 out of 27 ref:gbrp10le alpha:0
-> [swscaler @ 0x89aefc0] Forcing full internal H chroma due to input having non subsampled chroma
-> [auto-inserted scaler 0 @ 0x89aa3e0] w:4096 h:2160 fmt:gbrp10le sar:0/1 -> w:4096 h:2160 fmt:rgb24 sar:0/1 flags:0x4
[Parsed_pad_0 @ 0x89a95c0] w:4096 h:2160 -> w:5120 h:2160 x:0 y:0 color:0x000000FF
Output #0, rawvideo, to '/dev/null':
  Metadata:
    encoder         : Lavf55.19.104
    Stream #0:0, 0, 1/90000: Video: rawvideo (RGB[24] / 0x18424752), rgb24, 5120x2160, 1/25, q=2-31, 200 kb/s, 90k tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (dpx -> rawvideo)
Press [q] to stop, [?] for help
[output stream 0:0 @ 0x89a9b80] EOF on sink link output stream 0:0:default.
No more output streams to write to, finishing.
frame=    1 fps=0.0 q=0.0 Lsize=   32400kB time=00:00:00.04 bitrate=6635520.0kbits/s    
video:32400kB audio:0kB subtitle:0 global headers:0kB muxing overhead 0.000000%
1 frames successfully decoded, 0 decoding errors
[AVIOContext @ 0x89bc5c0] Statistics: 0 seeks, 1013 writeouts

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

We can pay a bounty for an appropriate fix that allows padding in high depth.

Change History (6)

comment:1 by Carl Eugen Hoyos, 10 years ago

Keywords: pad bounty added
Priority: normalwish
Reproduced by developer: set
Status: newopen
Version: unspecifiedgit-master

comment:2 by Andrey Utkin, 10 years ago

Could you please provide sample file, or instruction how to generate such file with ffmpeg?

in reply to:  2 comment:3 by Carl Eugen Hoyos, 10 years ago

Cc: Andrey Utkin added

Replying to Krieger:

Could you please provide sample file, or instruction how to generate such file with ffmpeg?

Could you elaborate? Which file do you need?

comment:4 by abc123, 10 years ago

You can reproduce by putting "format=yuv420p10le" or such at the front of any vf chain.

comment:5 by Elon Musk, 8 years ago

How much is bounty?

comment:6 by Elon Musk, 8 years ago

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