
'copy' means you're using the same codec as the input file. vcodec stands for the video codec to encode the output file. i is the input file, in the above case it's a file called 'input.mp4'. Lazily enough, I created a temporary directory on Desktop where I was storing the intermediate files as well as a single resulting video file.Get 3-Month FREE License (Limited Time) >īefore digging into how to use FFmpeg, keep in mind the powerful command: ffmpeg -ss 00:00:05 -t 6 -i input.mp4 -vcodec copy -acodec copy output.mov. First, it read two command line arguments, with the first ( $1) containing the path to the video file and with the second ( $2) storing the path to the file with the timestamps. Once such file was ready, I applied the following script:Įcho "Video cutting and assembling: $video_file "Įcho "Timestamps file: $timestamps_file "ĭo # Make array from the line (space-separated timestamps)Ĭlip_end = $ -gt 1 ] thenįfmpeg -y -f concat -safe 0 -i "$filelist " -c copy "$tmp_dir /merged.mp4" fi My approach to recording timestamps was to create a line for each “good” small portion of the video I wanted to produce, delimited with a starting and ending timestamp im the format of HH:MM::SS: 01:26:10 01:44:04

Once I was done with a portion of the original file that would further constitute a smaller clip with removed “bad” parts, I ran a bash script utilizimg ffmpeg to cut the big video in a set of smaller ones and then assemble them back in one single file.

My overall workflow was quite simple: I was rewatching the videos in VLC and recorded timestamps I wanted to cut away in a text file.

In this blog post I am going to summarize my experience with this task.

Surely, I wanted to do this programmatically using ffmpeg. Most parts of the videos contained the content I wanted to preserve, but I wanted to cut away some small portions and, additionally, split the big video files into a series of smaller ones. This summer I had a task of processing a large collection of videos that I recorded myself while teaching a course at NTNU.
