admin管理员组

文章数量:1365889

I want to loop push a part of video, such as the start 5 senonds, by cmd: ffmpeg -re -stream_loop -1 -ss 0 -t 5 -i xxx.mp4 -c copy -f flv rtmp://xxx Run the command, after 5 senonds error raise:

[flv @ 000001c7b4a0f040] Failed to update header with correct duration.4.7kbits/s speed=   1x
[flv @ 000001c7b4a0f040] Failed to update header with correct filesize.

It works fine if first using ffmpeg cut the video then pushing with out -t. Is there a way to do this together? Because the input file may be a file or a network stream.

I want to loop push a part of video, such as the start 5 senonds, by cmd: ffmpeg -re -stream_loop -1 -ss 0 -t 5 -i xxx.mp4 -c copy -f flv rtmp://xxx Run the command, after 5 senonds error raise:

[flv @ 000001c7b4a0f040] Failed to update header with correct duration.4.7kbits/s speed=   1x
[flv @ 000001c7b4a0f040] Failed to update header with correct filesize.

It works fine if first using ffmpeg cut the video then pushing with out -t. Is there a way to do this together? Because the input file may be a file or a network stream.

Share Improve this question asked yesterday se7enXFse7enXF 1321 silver badge6 bronze badges
Add a comment  | 

1 Answer 1

Reset to default -1

Try this:
ffmpeg -i xxx.mp4 -t 5 -c copy first5s.mp4

ffmpeg -re -stream_loop -1 -i first5s.mp4 -c copy -f flv rtmp://xxx

The "-t" has been applied to the input and is causing problems with FLV streaming. The FLV format expects a known duration and looping a segment on the fly might not work correctly.

本文标签: ffmpeg loop push rtmp error with when using arg tStack Overflow