FFMPEG:将Transmux mpegts转换为mp4会出现错误:muxer不支持不可搜索的输出 [英] FFMPEG: Transmux mpegts to mp4 gives error: muxer does not support non seekable output

查看:662
本文介绍了FFMPEG:将Transmux mpegts转换为mp4会出现错误:muxer不支持不可搜索的输出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当将mpegts传递到ffmpeg时,应将其转换为mp4并通过管道传递至stdout,ffmpeg表示:"muxer不支持不可搜索的输出".

When piping mpegts to ffmpeg, which should convert it to mp4 and pipe to stdout, ffmpeg says: "muxer does not support non seekable output".

经过大量研究,我得出的结论是,由于寻求搜索,mp4对于进行此类即时转码是一个不好的选择.因此,从本质上讲:MP4无法通过ffmpeg传递,这是有道理的.

After a lot of research I came to the conclusion that mp4 is a bad choice for doing those kinds of on-the-fly transcoding due to seeking. So in essence: MP4 cannot be piped through ffmpeg, which kind of makes sense.

但是我没有连续的mpegts流,我有5秒的块.所以实际上就像:

But I do not have a contiguous mpegts stream, I have chunks of 5 seconds. So it's really just like:

  • 这是我的1 mb * .ts文件
  • 请从管道中读取它,直到遇到EOF为止
  • 请将其多路传输到mp4(如果确实需要查找,请使用缓冲区)
  • 请将完整的内部mp4缓冲区通过管道传输到stdout

对于HTML5 MediaSource,我需要这些mp4块,碎片是没有问题的,我使用的是mp4box.js,它的工作原理很像魅力.

I need these mp4 chunks for a HTML5 MediaSource, the fragmentation is no problem, I use mp4box.js, which works like a charm.

问题:

  • FFMPEG可以执行这种内部缓冲吗?
  • 是否有更好的选择考虑?

本质上:我可以不使用文件(以某种方式)与ffmpeg进行交互吗?我当前的解决方案适用于文件并轮询新的块,这很丑.

In essence: Can I (somehow) interact with ffmpeg without using files ? My current solutions works with files and polling for new chunks, which is ugly.

如果您对我的ffmpeg命令感兴趣,请告诉我.

If you are interested in my ffmpeg command, just let me know.

推荐答案

由于您提到了碎片,因此您可以使用 movflags 启用它.从每个关键帧开始的片段示例:

Since you mentioned fragmentation then you can just enable it with movflags. Example for fragments starting on each keyframe:

ffmpeg -i segment.ts -c copy -movflags frag_keyframe+empty_moov -f mp4 -

具有一个空的 moov 原子意味着它不需要查找,因此可以与管道一起使用.

Having an empty moov atom means it doesn't need to seek and thus works with a pipe.

这篇关于FFMPEG:将Transmux mpegts转换为mp4会出现错误:muxer不支持不可搜索的输出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆