我正在研究 DASH,试图为最终用户优化 QoE。

我有一个视频并使用 ffmpeg 将其编码为不同的比特率,一切都很好,并且视频可以使用 dash 播放。

我想要的是将接收到的用户片段组合成一个 m4s 并将该 m4s 转换为 mp4。

我在ffmpeg中尝试了很多方法,但它总是给我这个错误:

[mov,mp4,m4a,3gp,3g2,mj2 @ 0x9a9e500] could not find corresponding track id 1
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x9a9e500] could not find corresponding trex
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x9a9e500] error reading header
test2.m4s: Invalid data found when processing input

segment_1.m4s 在那里。

我该如何解决这个问题?

最佳答案

这有效

将 m4s 段合并到一个文件中,确保文件顺序正确。例如。

cat video-0.m4s >> all.m4s
cat video-1.m4s >> all.m4s
cat video-2.m4s >> all.m4s
cat video-3.m4s >> all.m4s
cat video-4.m4s >> all.m4s
cat video-5.m4s >> all.m4s
cat video-6.m4s >> all.m4s
cat video-7.m4s >> all.m4s
cat video-8.m4s >> all.m4s
cat video-9.m4s >> all.m4s
cat video-10.m4s >> all.m4s

然后一次性完成所有转换。
ffmpeg -i all.m4s -c copy video.mp4

这不

我在尝试流式传输方法时遇到了同样的问题( could not find corresponding trex )。

我在 all.txt 文件中有我想要的所有文件,其中包含
file 'video-0.m4s'
file 'video-1.m4s'
file 'video-2.m4s'
file 'video-3.m4s'
file 'video-4.m4s'
file 'video-5.m4s'
file 'video-6.m4s'
file 'video-7.m4s'
file 'video-8.m4s'
file 'video-9.m4s'
file 'video-10.m4s'

我试过 ffmpeg -f concat -safe 0 -i all.txt -c copy video.mp4 ,导致同样的问题。
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x55fde2d0c520] Could not find codec parameters for stream 0 (Video: h264 (avc1 / 0x31637661), none, 1280x720): unspecified pixel format
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x55fde2d0c520] Auto-inserting h264_mp4toannexb bitstream filter
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x55fde2d0c520] could not find corresponding track id 1
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x55fde2d0c520] could not find corresponding trex
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x55fde2d0c520] error reading header
[concat @ 0x55fde2cff900] Impossible to open 'rifle-1.m4s'
[concat @ 0x55fde2cff900] Could not find codec parameters for stream 0 (Video: h264 (avc1 / 0x31637661), none, 1280x720): unspecified pixel format
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, concat, from 'all.txt':
[... omitted ...]
all.txt: Input/output error

关于video - ffmpeg 将 m4s 转换为 mp4,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/52705023/

10-11 08:37