2

After recording a live show, there are several tasks I need to do before I can render out the video file to different formats. I need to trim the file, and then resync the audio as well. After this I render the video file out to WAV, MP3 and MP4. I created a script like the one below (omitting the command for mp3, as this is just an example).

I'm obviously not very well versed in ffmpeg commands. The way this script works I first create a trimmed version, and then a second version that has the audio synced, before it finally does the encoding to other formats. Since I often have to do several massive files, I run into serious disk space problems with all the intermediary files being rendered out first.

Is there a way to combine the trim and resync command into one, so I can render out a trimmed and resynced master file?


ffmpeg -i ORIGINAL_TRIM.mxf -itsoffset 0.200 -i ORIGINAL_TRIM.mxf -map 0:v -map 1:a -c copy ORIGINAL_RESYNC.mxf

ffmpeg -i ORIGINAL_RESYNC.mxf -vn ORIGINAL.wav

ffmpeg -i ORIGINAL_RESYNC.mxf -c:v libx264 -preset slow -crf 22 -c:a aac ORIGINAL.mp4

Pause

1 Answer 1

1

As shown below,

ffmpeg -ss 00:01:00 -to 00:45:00 -i ORIGINAL.mxf
       -ss 00:01:00 -to 00:45:00 -itsoffset 0.200 -i ORIGINAL.mxf
       -map 0:v -map 1:a -c:v libx264 -preset slow -crf 22 -c:a aac ORIGINAL.mp4
       -map 1:a -vn ORIGINAL.wav
2
  • This is great! Thanks so much! One other thing though. How do I also keep a master recording (the mxf in this case) that is resynced? In this answer the original is encoded to different formats like I asked, and to see the syntax is great, but I also need a version that is not re-encoded, just with the audio corrected.
    – CCW
    Commented Oct 9, 2021 at 11:59
  • Actually. I have been trying to use the code a few times but the result is error notifications. I can't post it here as it has too many characters to post.
    – CCW
    Commented Oct 11, 2021 at 15:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.