0

I'm working on a batch file to concatenate 3 files together, as follows:

1_Intro_Bumper.mp4,
2_Session.mp4,
3_Outro_Bumper.mp4

I've run into problems with the session.mp4 having slightly different specs, causing the concat to have weird problems with speed/sync/etc, and found out that if I encode the Bumpers through Handbrake to the exact specs of the Session, then the concat works great.

My question is: Can I bypass Handbrake here and include a line in my batch file to encode the Intro and Outro Bumpers to the exact specs of the Session?

Here's my current batch file:

:: Create File List

for %%i in (*.mp4) do echo file '%%i'>> mylist.txt

:: Concatenate Files

ffmpeg -f concat -safe 0 -i mylist.txt -c copy output.mp4

:: Encode to x264

ffmpeg -i output.mp4 output_x264.mp4

Thanks!

  • Try removing the `-c copy`. It looks like you are re-encoding the concatenated output anyway, so you can concatenate and encode in a "single pass". It's a good practice to select the codecs and relevant codecs parameters explicitly. Example: `ffmpeg -f concat -safe 0 -i mylist.txt -acodec aac -vcodec libx264 -crf 18 -pix_fmt yuv420p output_x264.mp4` – Rotem Dec 15 '21 at 22:55
  • @Rotem, thanks! Removing that `-c copy` helped save a step. For the second part, I'm still getting the same issues when encoding after specifying the parameters. Would I need to encode each of the mp4s to specific parameters before trying to concatenate them? – BCooper Dec 16 '21 at 00:12
  • I thought you can do everything in one step. In case the parameters of the input are too different (like different video frame rate), it might not work with concat demuxer. You may try using concat filter instead. Check the following [post](https://stackoverflow.com/questions/7333232/how-to-concatenate-two-mp4-files-using-ffmpeg). – Rotem Dec 16 '21 at 06:41

0 Answers0