所以我决定尝试为IIS的Smooth Streaming创建自己的客户端作为学习练习,我正在努力解码mp4片段。
我有以下片段: http://www.mediafire.com/download/n32660d920g291c/part+1.mp4
当我尝试使用ffmpeg解码时:
C:\>ffplay.exe -f h264 -vcodec h264 -g 52 "part 1.mp4"
ffplay version N-58502-g738ebb4 Copyright (c) 2003-2013 the FFmpeg developers built on Nov 27 2013 22:09:34 with gcc 4.8.2 (GCC)
configuration: --disable-static --enable-shared --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis--enable-libvpx --enable-libwavpack --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
libavutil 52. 55.100 / 52. 55.100
libavcodec 55. 44.100 / 55. 44.100
libavformat 55. 21.102 / 55. 21.102
libavdevice 55. 5.102 / 55. 5.102
libavfilter 3. 91.100 / 3. 91.100
libswscale 2. 5.101 / 2. 5.101
libswresample 0. 17.104 / 0. 17.104
libpostproc 52. 3.100 / 52. 3.100
[h264 @ 0000000001e58260] non-existing PPS referenced 0B f=0/0
[h264 @ 0000000001e58260] non-existing PPS 25 referenced
[h264 @ 0000000001e58260] decode_slice_header error
[h264 @ 0000000001e58260] Invalid mix of idr and non-idr slices
[h264 @ 0000000001e58260] sps_id out of range
Last message repeated 4 times
[h264 @ 0000000001e58260] non-existing PPS referenced
[h264 @ 0000000001e58260] sps_id out of range
Last message repeated 4 times
[h264 @ 0000000001e58260] slice type too large (24) at 0 0
[h264 @ 0000000001e58260] decode_slice_header error
[h264 @ 0000000001e58260] no frame!
[h264 @ 0000000001e4fa00] decoding for stream 0 failed
[h264 @ 0000000001e4fa00] Could not find codec parameters for stream 0 (Video: h264): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
part 1.mp4: could not find codec parameters
阅读后我发现PPS / SPS来自IIS给我的清单中的CodecPrivateData,我有:
000000016764001eacd940a03da10005161501312d000f162d960000000168ebe3cb22c0
二进制:http://www.mediafire.com/download/hm3av6h3i1g7ojf/CodecPrivateData
我认为这是附件b 00000001 [SPS] 00000001 [PPS]但是我不知道该如何处理它,我已经尝试将它放在文件的开头但得到同样的错误,我也尝试过只是mdat中的数据并将其发送到ffmpeg但我得到了
[h264 @ 0000000001da8a80] sps_id out of range 0KB sq= 0B f=0/0
[h264 @ 0000000001da8a80] non-existing PPS referenced
[h264 @ 0000000001da8a80] sps_id out of range
[h264 @ 0000000001da8a80] slice type too large (24) at 0 0
[h264 @ 0000000001da8a80] decode_slice_header error
[h264 @ 0000000001da8a80] no frame!
[h264 @ 0000000001d9fa00] decoding for stream 0 failed
[h264 @ 0000000001d9fa00] Could not find codec parameters for stream 0 (Video: h264): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
part 1 - Copy.mp4: could not find codec parameters
所以我接着尝试将CodecPrivateData放在mdat部分之前,然后我得到了这个
[h264 @ 0000000001d38a80] sps_id out of range 0KB sq= 0B f=0/0
Last message repeated 1 times
[h264 @ 0000000001d38a80] slice type too large (24) at 0 0
[h264 @ 0000000001d38a80] decode_slice_header error
[h264 @ 0000000001d38a80] no frame!
[h264 @ 0000000001d2fa00] decoding for stream 0 failed
[h264 @ 0000000001d2fa00] Could not find codec parameters for stream 0 (Video: h264 (High)): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
part 1 - Copy.mp4: could not find codec parameters
我似乎错过了要解码的东西,我只是不确定是什么,所以我希望知道h264的人可以帮助我!最终我希望在DirectShow中使用它,但即使让它在ffmpeg中工作也将是一个巨大的帮助!
答案 0 :(得分:1)
mp4片段本身无法解码。如果您希望将其转换为mp4,则需要完整地重新创建moov原子。这包括制作包含avcc格式的extradata(sps / pps)的avc1原子。