FFmpeg: Basics, Trim and Concatenate

Location:
FFmpeg can either be installed individually or as part of other applications. E.g. if installed together with Audacity usually the entire contents of the downloaded ZIP file are extracted to a folder anywhere on the computer, then the Libraries Preferences are configured to locate the file "avformat-55.dll".
One location could be C:\Program Files (x86)\FFmpeg for Audacity.

Basic Conversion:
FFmpeg can be overwhelming with its options. If you only want to encode a larger video to MP4 and do not care much about smaller compression artifacts go for:
ffmpeg -i "input.avi" "output.mp4"

Basic Trim (Cut) from/to:
e.g. from the begin of the file to 45 1/2 seconds.
ffmpeg -i "input.mp4" -ss 00:00:00 -to 00:00:45.5 -c:v copy -c:a copy "output.mp4"

For some stream-to-MP4-rips the audio bitstream filter 'aac_adtstoasc' might be needed as follows:
ffmpeg -i "input.mp4" -ss 00:00:00 -to 00:00:45.5 -c:v copy -bsf:a aac_adtstoasc -c:a copy "output.mp4"

This will prevent the error message:
[mp4 @ 00f24880] Malformed AAC bitstream detected: use audio bitstream filter 'aac_adtstoasc' to fix it ('-bsf:a aac_adtstoasc' option with ffmpeg)
av_interleaved_write_frame(): Operation not permitted
[mp4 @ 00f24880] Malformed AAC bitstream detected: use audio bitstream filter 'aac_adtstoasc' to fix it ('-bsf:a aac_adtstoasc' option with ffmpeg)

Basic Concatenate (Join, Append, Add)
Again, FFmpeg allows to tweak the output with multiple options. On concatenation there are actually 3 different methods how to join videos. See the provided sources for further details. But for the average user likely the Concat Demuxer will fully suffice:
First create a file that contains the location of the files to later use on the FFmpeg commandline like:
file 'fullpath\input1.mp4' file 'fullpath\input2.mp4'
Let's assume the file is called 'myfile.txt' the following will let FFmpeg join the files in the given order: ffmpeg -f concat -i "mylist.txt" -c copy "output.mp4"


Sources:

Comments

Popular posts from this blog

SQL Server Setup: Windows Firewall warning (Ports)

SQL Server 2014 Enterprise Edition: Server Setup: Feature Selection

How to read an assembly.dll.config