我有一组FLV文件,我想用GStreamer播放。所有文件都有不正确的头/元数据,像这样:
https://drive.google.com/file/d/1FcKbYd2-D7ZiIG5VpRxpbqshCixp8iaR/view?usp=sharing
VLC和ffplay都可以使用它们的特殊魔力来播放这个文件。虽然,Mediainfo显示截断的视频信息的文件:
Video
Format : AVC
Format/Info : Advanced Video Codec
Codec ID : 7
Duration : 12 s 633 ms
Frame rate mode : Constant
Frame rate : 60.000 FPS
Bit depth : 8 bits
对于正确的文件,至少有格式配置文件和级别。
gst-discoverer-1.0
根本不想检测视频流:
Properties:
Duration: 0:00:00.116000000
Seekable: yes
Live: no
container: Flash
audio: MPEG-4 AAC
Stream ID: a72c1038e0bf52d7668cb945588d7bca2547bd58212aa7f08db439aeadfcbd95/audio
Language: <unknown>
Channels: 2 (front-left, front-right)
Sample rate: 48000
Depth: 32
Bitrate: 0
Max bitrate: 0
video: H.264
Stream ID: (NULL)
Width: 0
Height: 0
Depth: 0
Frame rate: 0/1
Pixel aspect ratio: 1/1
Interlaced: false
Bitrate: 0
Max bitrate: 0
gst-play-1.0
启动,但显示错误且不显示预览:
gst-play-1.0.exe "C:UsersmeDownloadscustom.flv"
Press 'k' to see a list of keyboard shortcuts.
Now playing C:UsersmeDownloadscustom.flv
WARNING No decoder available for type 'video/x-h264, stream-format=(string)avc, codec_data=(buffer)000000016742c020da014016ec0440000003004000001e03c60ca80000000168ce3c80'.
WARNING debug information: ../gst/playback/gsturidecodebin.c(960): unknown_type_cb (): /GstPlayBin:playbin/GstURIDecodeBin:uridecodebin0
Redistribute latency...
0:00:12.6 / 0:00:12.6
Reached end of play list.
我正在寻找任何方法,要么使GStreamer播放这样的文件正确(也许有一些插件允许这样做?)或修复视频头。
用FFMPEG重新制作视频文件:
ffmpeg -i custom.flv -c:v copy -c:a copy fixed.flv
问题出在视频标题中。为了生成标题,我使用了FFmpeg编码器返回的额外数据。但是头不仅仅是额外的数据,它应该按照ISO/IEC-14496-15标准生成AVCDecoderConfigurationRecord
结构。