5

I am trying to write streamable (fragmented?) mp4 files with FFMpeg. But the default of the FFMpeg bahavior of the -f mp4 format is not this one.

Take for example this AAC-LC MP4 test file save it as aac_lc_in.m4a and run the ffmpeg command:

ffmpeg -y -i aac_lc_in.m4a -strict -2 -codec copy -f mp4 aac_lc_out.m4a 

The result is a non-streamable file (put it on a server and try to load it in your browser. It only starts after it is completely downloaded). This does not happen with the original file that can be started before the download completes.

I also tried using the mp4 format parameters:

-movflags frag_keyframe+empty_moov
-movflags faststart+frag_keyframe
-movflags faststart+frag_keyframe+empty_moov
-movflags faststart+rtphint+frag_keyframe
-movflags rtphint+frag_keyframe
-movflags rtphint+frag_keyframe -rtpflags latm

but nothing helped. Even if the output file looks very similar to the original one (File format box, sample table boxes, etc.), the generated file is not streamable.

4

1 回答 1

3

我找到了解决方案。仅使用格式的-movflags faststart参数mp4。完整的命令是:

ffmpeg -i aac_lc_in.m4a -strict -2 -codec copy -f mp4 -movflags faststart aac_lc_out.m4a

现在aac_lc_out.m4a,只要单击播放,浏览器就会播放该文件。

于 2013-04-21T13:52:05.147 回答