2015-06-15 42 views

回答

3

不,你不能。 ffmpeg中没有这样的命令来循环播放视频。您只能将-loop用于图像。如果您有兴趣,可以使用concat demuxer。创建一个播放列表文件,例如playlist.txt

内playlist.txt添加视频定位

file '/path/to/video/video.mp4' 
file '/path/to/video/video.mp4' 
file '/path/to/video/video.mp4' 
file '/path/to/video/video.mp4' 
file '/path/to/video/video.mp4' 

运行ffmpeg

ffmpeg -f concat -i playlist.txt -c copy output.mp4 

here

+2

您可以使用流循环“-stream_loop”或循环过滤器循环视频:“-filter_complex loop = repeat:size:start”以获取更多信息阅读[FFMPEG网站]上的文档(https:// ffmpeg.org/ffmpeg-filters.html#loop) – user2843110

+0

还有'movie ='可以循环,并且在这里工作正常。 –

7

您应该能够使用-stream_loop -1标志的前输入(-i):

ffmpeg -threads 2 -re -fflags +genpts -stream_loop -1 -i ./test.mp4 -c copy ./test.m3u8 

-fflags +genpts将重新生成pts时间戳,以便顺利循环,否则时间顺序将因循环而不正确。

+1

stream_loop错误仍然发生。 – Mulvya

+1

ffmpeg工作正常3.3 Ubuntu 16.04有2.8 IIRC。谢谢。 – Ark74