[Libav-user] Does the image2 demuxer work with a custom AVIOContext?

Robert Krüger krueger at lesspain.de
Wed Feb 19 17:17:33 CET 2014


On Mon, Jan 13, 2014 at 3:53 PM, Robert Krüger <krueger at lesspain.de> wrote:
> On Mon, Jan 13, 2014 at 11:57 AM, Carl Eugen Hoyos <cehoyos at ag.or.at> wrote:
>> Robert Krüger <krueger at ...> writes:
>>
>>> Could you elaborate a bit what would be needed to make
>>> this work, i.e. demuxing single images (not a series)
>>> like jpg, png, dpx
>>
>> jpg and png and dpx should work fine with image2pipe
>
> OK, so just to avoid misunderstandings: What I would have to do is to
> first determine the file type myself (e.g. by file extension) and if
> it is one that should use the image2pipe demuxer (for simplicity's
> sake let's say that's jpg, png and dpx) I obtain an instance of
> AVInputFormat (using
> av_find_input_format) for image2pipe and then call avformat_open_input
> using that input format pointer. Is that correct?
>
>>
>>> and probably others covered by the image2 demuxer
>>
>> Which others?
>> Some will have constant frame size, for the rest a
>> parser would be needed.
>>

I did this:

- get the image2pipe demuxer by calling av_find_input_format
- get the dpx codec by avcodec_find_decoder_by_name with "dpx"
- set dpx as video codec in my format context using av_format_set_video_codec
- opened the file using avformat_open_input specifying the image2pipe demuxer

This works for some dpx files for which a corresponding command line
also works. However for some it fails (e.g. the fate sample
lighthouse_rgb48.dpx), for which this command line also fails:

cat ~/samples/fate/dpx/lighthouse_rgb48.dpx | ./ffmpeg -f image2pipe
-vcodec dpx -i - ~/tmp/fromdpx_pipe2.png
ffmpeg version N-60736-gb14517d Copyright (c) 2000-2014 the FFmpeg developers
  built on Feb 19 2014 17:14:26 with llvm-gcc 4.2.1 (LLVM build 2336.11.00)
  configuration:
  libavutil      52. 64.100 / 52. 64.100
  libavcodec     55. 52.102 / 55. 52.102
  libavformat    55. 33.100 / 55. 33.100
  libavdevice    55. 10.100 / 55. 10.100
  libavfilter     4.  1.103 /  4.  1.103
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
[dpx @ 0x7fcb21822600] Overread buffer. Invalid header?
Input #0, image2pipe, from 'pipe:':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: dpx, rgb48be, 768x512, 25 tbr, 25 tbn, 25 tbc
Output #0, image2, to '/Users/krueger/tmp/fromdpx_pipe2.png':
  Metadata:
    encoder         : Lavf55.33.100
    Stream #0:0: Video: png, rgb48be, 768x512, q=2-31, 200 kb/s, 90k tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (dpx -> png)
[dpx @ 0x7fcb21822600] Overread buffer. Invalid header?
Error while decoding stream #0:0: Invalid data found when processing input
pipe:: Input/output error
frame=    0 fps=0.0 q=0.0 Lsize=N/A time=00:00:00.00 bitrate=N/A
video:0kB audio:0kB subtitle:0 data:0 global headers:0kB muxing overhead -inf%
Output file is empty, nothing was encoded (check -ss / -t / -frames
parameters if used)

Is this a bug, shall I make a trac ticket?


More information about the Libav-user mailing list