I'm recording a live video on ffmpeg.When the live was over, the video was broken.

Asked 2 years ago, Updated 2 years ago, 97 views

I am currently recording and downloading live footage using the command below.

ffmpeg-i "EXAMPLE_URL" \
    -c copy-flags+global_header-f segment\
    -segment_time3600-segment_format_options movflags=+faststart\
    - reset_timestamps1 "EXAMPLE_%d.mp4"

The files are divided into one hour's worth.
Usually, there is no problem, but when the live is over,

ffmpeg last message repeated %N times appears and remains unresponsive for a long time.

If you finish with Ctrl+C after this, you will not be able to see the video at that time.(Probably damaged)

Could you tell me how to avoid this problem or if there are any options?

The best thing is that if the live destination ends without permission, the recording should end normally at that time.

Thank you for your cooperation.

ffmpeg

2022-09-30 14:17

3 Answers

If you finish using Ctrl+C after this, you will not be able to see the video at that time.

That's what mp4 does, so let's save it with ts.


2022-09-30 14:17

Since there is no "URL of live video to record", I looked at the options in ffmpeg (v4.0.2, binary for Windows) and found several options such as -timeout and -listen_timeout.

You can specify the number of seconds, but it seems that the units vary depending on the protocol, so please check carefully according to your environment.


2022-09-30 14:17

I think the commands are the same for Linux and Windows.
Windows batch file has an internal loop and is no longer responding.
If I remember correctly, when I searched by automatic termination -audoexit, it ends when the processing is finished.
Now you can create a batch file and play 50 music on ffplay and finish automatically.


2022-09-30 14:17

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.