[Libav-user] Which codec/parser/filter I missed to open a MP4 file ?

hanguofu hanguofu at 163.com
Thu May 19 15:08:40 CEST 2016


Hi, Carl :

Thanks for your prompt response. In fact , your suggestion was the first idea came to my mind. And I did tried in linux , the generated ffmpeg binary does work as below:

ffmpeg version 2.8 Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
  configuration: --disable-everything --enable-ffmpeg --enable-bsf=h264_mp4toannexb --disable-debug --enable-protocol='concat,file' --enable-demuxer=concat --enable-muxer=mp4 --disable-yasm --disable-runtime-cpudetect
  libavutil      54. 31.100 / 54. 31.100
  libavcodec     56. 60.100 / 56. 60.100
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 40.101 /  5. 40.101
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x1f91640] Auto-inserting h264_mp4toannexb bitstream filter
Guessed Channel Layout for  Input Stream #0.1 : stereo
Input #0, concat, from 'lists.txt':
  Duration: N/A, start: 0.036281, bitrate: 993 kb/s
    Stream #0:0(und): Video: h264 (avc1 / 0x31637661), none, 1280x720, 865 kb/s, 60 fps, 60 tbr, 15360 tbn, 15360 tbc
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, 2 channels, 128 kb/s
    Metadata:
      handler_name    : SoundHandler
[mp4 @ 0x1fc7340] Codec for stream 0 does not use global headers but container format requires global headers
[mp4 @ 0x1fc7340] Codec for stream 1 does not use global headers but container format requires global headers
[mp4 @ 0x1fc7340] track 1: codec frame size is not set
Output #0, mp4, to 'h264_aac_concat.mp4':
  Metadata:
    encoder         : Lavf56.40.101
    Stream #0:0(und): Video: h264 ([33][0][0][0] / 0x0021), none, 1280x720, q=2-31, 865 kb/s, 60 fps, 60 tbr, 15360 tbn, 15360 tbc
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac ([64][0][0][0] / 0x0040), 44100 Hz, stereo, 128 kb/s
    Metadata:
      handler_name    : SoundHandler
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x1f928a0] Auto-inserting h264_mp4toannexb bitstream filter
frame= 7198 fps=0.0 q=-1.0 Lsize=   14609kB time=00:02:00.09 bitrate= 996.5kbits/s   
video:12539kB audio:1877kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.344435%

-------------------------------------------------------------------------

However , this configuration does not work in the MinGW for windows :


C:\MinGW\msys\1.0\home\win32\source\ffmpeg28>.\ffmpeg_g.exe -loglevel "deb
ug" -i h264_aac.mp4
ffmpeg version 2.8 Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.9.3 (GCC)
  configuration: --prefix=/home/win32/install --disable-everything --enable-ffmp
eg --enable-bsf=h264_mp4toannexb --enable-debug --enable-protocol='concat,file'
--enable-demuxer='m4v,aac,h264' --enable-muxer=mp4 --enable-runtime-cpudetect --
enable-memalign-hack --extra-cflags=-I/home/win32/source/ffmpeg28 --extra-ldflag
s=-L/home/win32/source/ffmpeg28 --enable-parser='aac,h264,mpeg4video' --enable-g
pl --enable-libx264 --disable-doc --enable-decoder='aac,h264,mpeg4' --enable-enc
oder='aac,mpeg4,libx264' --enable-yasm --enable-w32threads --enable-static
  libavutil      54. 31.100 / 54. 31.100
  libavcodec     56. 60.100 / 56. 60.100
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 40.101 /  5. 40.101
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
Splitting the commandline.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level)
with argument 'debug'.
Reading option '-i' ... matched as input file with argument 'h264_aac.mp4'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set logging level) with argument debug.
Successfully parsed a group of options.
Parsing a group of options: input file h264_aac.mp4.
Successfully parsed a group of options.
Opening an input file: h264_aac.mp4.
[AVIOContext @ 02b813e0] Statistics: 1048576 bytes read, 0 seeks
h264_aac.mp4: Invalid data found when processing input

C:\MinGW\msys\1.0\home\win32\source\ffmpeg28>.\ffmpeg_g.exe -formats
ffmpeg version 2.8 Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.9.3 (GCC)
  configuration: --prefix=/home/win32/install --disable-everything --enable-ffmp
eg --enable-bsf=h264_mp4toannexb --enable-debug --enable-protocol='concat,file'
--enable-demuxer='m4v,aac,h264' --enable-muxer=mp4 --enable-runtime-cpudetect --
enable-memalign-hack --extra-cflags=-I/home/win32/source/ffmpeg28 --extra-ldflag
s=-L/home/win32/source/ffmpeg28 --enable-parser='aac,h264,mpeg4video' --enable-g
pl --enable-libx264 --disable-doc --enable-decoder='aac,h264,mpeg4' --enable-enc
oder='aac,mpeg4,libx264' --enable-yasm --enable-w32threads --enable-static
  libavutil      54. 31.100 / 54. 31.100
  libavcodec     56. 60.100 / 56. 60.100
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 40.101 /  5. 40.101
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
File formats:
 D. = Demuxing supported
 .E = Muxing supported
 --
 D  aac             raw ADTS AAC (Advanced Audio Coding)
 D  h264            raw H.264 video
 D  m4v             raw MPEG-4 video
  E mov             QuickTime / MOV
  E mp4             MP4 (MPEG-4 Part 14)

C:\MinGW\msys\1.0\home\win32\source\ffmpeg28>

( With this configuration , I tried both the gcc compiler and vs2013 compiler ( with one more config : --toolchain=msvs and introduction of vcvars32.bat) . Both of
them has the same problem : the generated ffmpeg.exe cannot open my MP4 files. )
----------------------------------------------------------------------

So , finally I had to use the following configuration to build a good ffmpeg.exe , as well as the related libav* libraries for my vs2013 project :

 ./configure   --prefix='/home/win32/install'   --enable-bsf=h264_mp4toannexb  --disable-debug --enable-protocol='concat,file' --enable-demuxer=m4v,aac,h264 --enable-muxer=mp4   --enable-memalign-hack    --disable-doc  --enable-yasm --disable-manpages --disable-w32threads  --enable-static  --toolchain=msvc
 

The generated ffmpeg.exe and the libav* libraries do work as expected. As for the libav* libraries , if I use the original av_register_all() function , everything is fine. But if I use my own function my_av_register_all() , then I ran into the prorblem I mentioned in my previous email : Invalid data found when processing input




If you or everybody need more info. , please feel free to let me know.

Regards !


Guofu Han
















At 2016-05-19 16:18:12, "Carl Eugen Hoyos" <cehoyos at ag.or.at> wrote:
>hanguofu <hanguofu at ...> writes:
>
>> Since my project only caters to MP4 file with AAC and H.264 , 
>> I replace the original av_register_all() with the following 
>> functions to minimize the generated binary :
>
>Use the configure option --disable-all with the necessary 
>enable options instead and leave the register function 
>untouched.
>
>Carl Eugen
>
>_______________________________________________
>Libav-user mailing list
>Libav-user at ffmpeg.org
>http://ffmpeg.org/mailman/listinfo/libav-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20160519/f16811ca/attachment.html>


More information about the Libav-user mailing list