video - 播放没有文件头的 mp4 视频
问题描述
我正在为摄像机构建一些硬件和软件。硬件在将数据写入 SD 卡时捕获数据,并将数据传输到显示视频的 PC。
我需要帮助来解码和显示没有 mp4 文件标题的视频。对应于视频开始后捕获和显示视频。
我可以用 Gstreamer 播放我的示例视频
gst-launch-1.0 filesrc location=full.mp4 ! qtdemux name=demux demux.video_0 ! queue ! decodebin ! videoconvert ! videoscale ! autovideosink
如果我拿文件的中间部分
tail -c $(( 10*1024*1024 )) full.mp4 | head -c $(( 5*1024*1024 )) > middle.mp4
-我不确定如何播放文件了。
我的问题是: 如何播放缺少 mp4 文件头的文件?
有关示例视频的额外信息 (full.mp4)
gst-discoverer-1.0 file:///home/username/Videos/full.mp4 -v
Analyzing file:///home/quist/Videos/full.mp4
Done discovering file:///home/quist/Videos/full.mp4
Topology:
container: video/quicktime
audio: audio/mpeg, mpegversion=(int)4, framed=(boolean)true, stream-format=(string)raw, level=(string)2, base-profile=(string)lc, profile=(string)lc, codec_data=(buffer)1210, rate=(int)44100, channels=(int)2
Tags:
audio codec: MPEG-4 AAC audio
maximum bitrate: 256000
bitrate: 3108
language code: en
encoder: Lavf55.33.100
container format: Quicktime
Codec:
audio/mpeg, mpegversion=(int)4, framed=(boolean)true, stream-format=(string)raw, level=(string)2, base-profile=(string)lc, profile=(string)lc, codec_data=(buffer)1210, rate=(int)44100, channels=(int)2
Additional info:
None
Stream ID: ac6b090d044d63146735090a310b819cd64304c2ee05c9ee590009622318d12b/002
Language: en
Channels: 2 (front-left, front-right)
Sample rate: 44100
Depth: 32
Bitrate: 3108
Max bitrate: 256000
video: video/x-h264, stream-format=(string)avc, alignment=(string)au, level=(string)4.1, profile=(string)high, codec_data=(buffer)01640029ffe1001967640029acd9405005bb0110000003001000000780f183196001000468efbcb0, width=(int)1280, height=(int)720, framerate=(fraction)60/1, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, parsed=(boolean)true
Tags:
video codec: H.264 / AVC
language code: en
bitrate: 8082504
encoder: Lavf55.33.100
container format: Quicktime
Codec:
video/x-h264, stream-format=(string)avc, alignment=(string)au, level=(string)4.1, profile=(string)high, codec_data=(buffer)01640029ffe1001967640029acd9405005bb0110000003001000000780f183196001000468efbcb0, width=(int)1280, height=(int)720, framerate=(fraction)60/1, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive, chroma-format=(string)4:2:0, bit-depth-luma=(uint)8, bit-depth-chroma=(uint)8, parsed=(boolean)true
Additional info:
None
Stream ID: ac6b090d044d63146735090a310b819cd64304c2ee05c9ee590009622318d12b/001
Width: 1280
Height: 720
Depth: 24
Frame rate: 60/1
Pixel aspect ratio: 1/1
Interlaced: false
Bitrate: 8082504
Max bitrate: 0
Properties:
Duration: 0:00:18.167000000
Seekable: yes
Live: no
Tags:
video codec: H.264 / AVC
language code: en
bitrate: 8082504
encoder: Lavf55.33.100
container format: Quicktime
audio codec: MPEG-4 AAC audio
maximum bitrate: 256000
解决方案
你不能用头/尾截断 MP4 - 你可以用 MPEG-2 传输流来做到这一点,可能并非完全没有问题。
但是你可以使用 ffmpeg 代替 head/tail:
ffmpeg -i full.mp4 -vcodec copy -acodec copy -ss 00:10:00 -to 00:20:00 middle.mp4
推荐阅读
- vb.net - 如何通过更改 vb .net 中的自定义属性网格来更改标签字体?
- kotlin - Serenity BDD 项目模式
- javascript - 如何在表中传递隐藏字段并在 tr 单击时返回 jquery 中的值
- javascript - 自己的测试币/代币
- spring - 从 New Relic 警报策略中排除特定端点
- python - 如何使用 Open CV 和 Python 连接到康耐视相机
- ssl - SSL_read 无法读取服务器发送的所有字节
- java - java.lang.VerifyError:拒绝尝试子类型错误类 java.awt.geom.Point2D 的类 java.awt.Point:Android Studio
- graphql - 折扣价不适用于 magento 2 graphql 产品查询中的捆绑产品选项价格
- android - Flutter 应用程序未安装在物理设备上`