using ffmpeg to chop off the end of a video without seeking through the whole damn thing
On 12/29/2019 at 10:44 PM, babadoctor said:so I have been using the following command to get the last 10 minutes of a very very long livestream
ffmpeg -i "livestream.mp4" -ss 03:00:00 -t 00:10:00 -codec "copy" "output.mp4"this takes forever if the video is longer than 12 hours.
is there really no way to just kind of lob off the end of the video with ffmpeg? why does it need to seek through the entire video to find the end of the video?????
it's really stupid and there has to be a better way.
This is especially bad when I need to do it over the internet, as it requires downloading the ENTIRE 12 hour video when I can clearly seek to the end of it with my player.
Any suggestions?
Rookie mistake, I've done that myself since it's really confusing haha
You did -ss after the input file, which means that it'll try to seek the output file instead of the input. You can read more about it here.
An example of what you want to do is:
ffmpeg -ss 24 -i "http://distribution.bbb3d.renderfarming.net/video/mp4/bbb_sunflower_1080p_30fps_normal.mp4" -to 10 -c:v copy -c:a copy test.mp4
Which seeks the big buck bunny video to second 24 and tries to download 10 seconds of it into the test.mp4 file while coping the media without doing any transcode.
Notice that the actual output duration won't be 10 seconds due to frame splitting. I hack to get around that that I had to do at work was to use ffprobe to check the amount of frames, and then seek through frames instead of seconds.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now