ffmpeg is a powerful command line tool to create, record, manipulate, stream and convert video files.
How to concatenate audio files
Create a text file that contains every audio file in a single row starting with the keyword file, for example:
file /tmp/input1.wav
file /tmp/input2.wav
Then use the following command (in this case the text file is called tracks.txt)
> ffmpeg -f concat -safe 0 -i tracks.txt -c copy output.wav
How to create a video from a mp3 and a picture (freeze image)
For YouTube upload:
> ffmpeg -loop 1 -framerate 1 -i image.jpg -i music.mp3 \
-c:v libx264 -preset veryslow -crf 0 -c:a copy -shortest output.mkv
A more generic approach that should work with every player:
> ffmpeg -loop 1 -i image.png -i music.mp3 -vf "scale='min(1280,iw)':-2,format=yuv420p" \
-c:v libx264 -preset veryslow -profile:v main -c:a aac -shortest -movflags \
+faststart output.mp4
Add waveform to video
> ffmpeg -i input.mp4 \
-filter_complex "[0:a]showwaves=s=600x300:colors=#FFFFFF|#808080:mode=line:draw=full,format=argb[v];[0:v][v]overlay=(W-w)/5.5:(H-h)/1.3[outv]" \
-map "[outv]" -pix_fmt yuv420p -map 0:a -c:v libx264 -c:a copy \
output.mp4
How to downscale a video to 1080p HD
Not all videos require 4k or more, sometimes normal HD is sufficient:
ffmpeg -i input4k.mp4 -vf scale=1920:1080 -c:a copy output1080.mp4
How to change the video codec
ffmpeg will automatically recognize the source codec, so you only have to specify the target codec. This is an example for x265 with Apple compatibility (hvc1). The audio codec is simply copied:
ffmpeg -i input.mp4 -c:v libx265 -tag:v hvc1 -c:a copy output.mp4