Thursday, December 14, 2017

Video Editing with FFMPEG

I had a task in which I had to edit a documentary. As always, I used Blender as my Video Editor e everything was going fine and fast. Until I had to render, that is. A task that usualy takes 1h, max, was taking almost 7hs. And there was a problem in one of the scenes and I had to replace the scene but I had no time to render the whole project again.

So I did a web search on how to cut and concatenate videos with FFMPEG. And guess what, it worked.

First I cut the vídeo, creating 2 files. One with the content before the scene and another with the content after the scene.

ffmpeg -i RetratoFalado-720x480.mkv -ss 00:00:00 -t 00:13:53 -async 1 RetratoFalado-720x480-P1.mkv

ffmpeg -i RetratoFalado-720x480.mkv -ss 00:14:09 -t 00:20:00 -async 1 RetratoFalado-720x480-P2.mkv

Then, with the new video file for the scene I concatenated the vídeos

ffmpeg -f concat  -safe 0 -i c-mergelist.txt -c copy RetratoFaladoFix.mkv

Where the c-mergelist.txt file is a list of vídeos to be concatenated.

file './RetratoFalado-720x480-P1.mkv'

file './RetratoFalado-720x480-chorando.mkv

file './RetratoFalado-720x480-P2.mkv'

And, in just a few minutes, I had the documentary fixed.

No comments: