Split section of video with ffmpeg
Posted
by
Rob
on Super User
See other posts from Super User
or by Rob
Published on 2012-10-07T03:11:19Z
Indexed on
2012/10/07
3:41 UTC
Read the original article
Hit count: 528
I've been trying to get this to work and I'm really close, but something still isn't right.
I have a 14 second clip I'm trying to cut out of a longer mp4 video. I got the video to cut to the right place with this command:
ffmpeg -ss 00:05:13.0 -i ~/videos/trim_me.mp4 -vcodec h264 -acodec copy -t 00:00:14.0 ~/videos/trimmed.mp4
If I didn't specify -vcodec
it was starting from an "I-Frame" (I guess) and wasn't the right place. The audio is starting from that spot as well, so I tried setting -acodec
the same way:
ffmpeg -ss 00:05:13.0 -i ~/videos/trim_me.mp4 -vcodec h264 -acodec aac -ac 2 -ab 225k -ar 48000 -strict -2 -t 00:00:14.0 ~/videos/trimmed.mp4
Which doesn't really help much. Setting -async 1
makes it take longer, and then the audio does match up, but not until 4 seconds into the video. :/
I'd ideally not like to install anything else and have a commandline solution for this.
© Super User or respective owner