1
1
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.
2
It's definitely better to use
– evilsoup – 2013-09-06T20:31:13.293ffprobe
for getting this information, if you're going to script it. The-show_format
and-show_streams
options will be useful (see the ffprobe man page or the online documentation) -- outputs one key=value pair per line, so it's easier to parse with grep or sed or whatever.Yeah - I went with ffmpeg for the answer because it's a lowest common denominator. Lot of the time people seem to have found a windows ffmpeg binary somewhere and have nothing else. – Dan Pritts – 2013-09-09T19:20:20.860