I have 2 video files (flv). One has the video and the other has the audio. I wrote a script using ffmpeg that extracts the audio as mp3, then merges it with the video flv. It works, except that my audio and video are out of sync because the audio is longer than the video. They started recording the meeting's audio before the video.
For completeness, here are my 2 commands:
msg "Extracting Audio" ./ffmpeg -loglevel panic -i cameraVoip*.flv -vn -acodec mp3 output_audio.mp3 msg "Merging Audio with Video" ./ffmpeg -loglevel panic -i output_audio.mp3 -i screenshare*.flv -acodec copy -vcodec copy output_video.flv
This got me to thinking, ffmpeg is combining the 2 files together from the beginning of each file. Is there a way I can tell it match from the end, and ignore extra at the beginning?
I know I could edit each file to get them to the same size, but I'd like to make this as automated as possible.