- Useful ffmpeg commands to do all sorts of cool things
- Very granular config options
- A quick guide to using ffmpeg to convert media files
- Extract specific audio tracks from video
- Convert avi to mp4, lossless and free (as in freedom)
Step 1: Create a text file containing all the files
ls *.mp4 | while read each; do echo "file '$each'" >> mylist.txt; done
Step 2: Use the concat demuxer method
ffmpeg -f concat -safe 0 -i mylist.txt -c copy output_filename.mp4
ffmpeg -i my_movie.mkv -vcodec copy -acodec copy -strict -2 my_movie.mp4
ffmpeg -i "original_file.mp4" -map 0:v -map 0:2 -c:v libx265 -preset medium -crf 28 -c:a copy original_file_audio_track.aac
Option 1:
ffmpeg -i video.mp4 -i audio.mp3 -c:v copy -c:a aac -strict experimental output.mp4
Option 2:
ffmpeg -I video.mp4 -I audio.m4a -c:a copy outputFile.mp4
Option 3:
ffmpeg -i video.mp4 -i audio.wav -c copy output.mkv
def get_metadata(file):
ffmpegBase = '/usr/local/bin/ffmpeg -i '
os.chdir(BaseDir)
readMD = subprocess.Popen(
['/usr/local/bin/ffmpeg','-i', file],
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
print(readMD.stdout.read().decode("utf-8"))```