Concatenate and reduce mp4 size with ffmpeg?

Might be kindof a hack, but this seem to automatically concat all the .mp4s in the current folder into one. It uses the foldername (stripped of whitespaces) for the output name. Might have numerous flaws, so use at own risk. Its just a mix and match of different snippets from stackoverflow.

Concat w/o re-encode:

for f in ./*.mp4; do echo "file '$f'" >> l.txt; done; ffmpeg -f concat -safe 0 -i l.txt -c copy $(printf '%s\n' "${PWD##*/}" | tr -d '[:space:]').mp4; rm l.txt

Re-encode to lower file-size:

ffmpeg -i input.mp4 -vcodec libx265 -crf 20 output.mp4

Continue reading