[FFmpeg-devel] Issue using AVIOContext

Jorge A. Rodríguez Campos jorgerdc at gmail.com
Wed Oct 7 03:59:05 CEST 2015


Hi,
I'm testing a program using  AVIOContext to extract some frames of a video,
I need to use an InputStream not a URL.  I'm using the source code of
avio_reading.c  to test my sample videos (
https://www.ffmpeg.org/doxygen/trunk/avio__reading_8c_source.html)

I tested this program with video1.wmv without any problems.
After that I converted video1.wmv into some video formats like mp4, mov,
asf, and avi

I got some errors only with mp4 and mov videos, the error is the same in
both cases:

[mov,mp4,m4a,3gp,3g2,mj2 @ 0x188ed00] stream 0, offset 0x30: partial file
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x188ed00] Could not find codec parameters for
stream 0 (Video: h264 (avc1 / 0x31637661), none, 960x540, 728 kb/s):
unspecified pixel format
Consider increasing the value for the 'analyzeduration' and 'probesize'
options

I have tried to increase these values without success.
Looking into the output of this program, I noticed that all video is
scanned in order to find these parameters. So, I think the problem is that
some metadata are lost when I converted  from wmv to mp4.

I used this command to convert
ffmpeg -i video1.wmv -q:v 0 -vcodec libx264 -pix_fmt yuv420p video1.mp4

this is the output of av_dump_format using C program

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'videos/bigdata.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf56.25.101
  Duration: 00:01:07.02, bitrate: N/A
    Stream #0:0(eng): Video: h264 (avc1 / 0x31637661), none, 960x540, 728
kb/s, 30 fps, 30 tbr, 15360 tbn (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 32000 Hz, 2 channels,
93 kb/s (default)
    Metadata:
      handler_name    : SoundHandler

As you can see, there is a "none" value,  but I don't know how to fix this.
However, I tested this video without using an AVIOContext, and it works
fine.
Also, I tested it using ffmpeg command and also it works.

Finally this is the output of  ffmpeg -i  with this same video.

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'videos/video1.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf56.25.101
  Duration: 00:01:07.02, start: 0.064000, bitrate: 824 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p,
960x540, 728 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 32000 Hz,
stereo, fltp, 93 kb/s (default)
    Metadata:
      handler_name    : SoundHandler


What do you think ?  I'm missing something when converting the video, or  I
need to add some lines in avio_reading.c ?
I'm using ffmpeg 2.6.2
thanks


More information about the ffmpeg-devel mailing list