Question

I have a tool that spits out video from a 3D application and then concats the individual videos to make a sequence. But the sound seems to go out of sync in the sequence (the inividual files are fine) and it stutters in VLC and Quicktime. Windows media player seems to handle it bes to my supprise, yet it still goes out of sync. I have two senarios, one works and one doesn't but i need both working:

Working:
get already created out movs...

convert to avi:
os.system( ffmpeg + " -i C:\clip.mov -sameq -r 24 -y C:\clip.avi")

concat to avi sequence:
os.system( ffmpeg + ''' -i concat: C:\clip.avi|C:\clip1.avi|C:\clip2.avi -sameq -r 24 -y C:\sequence.avi''' )

convert sequence to mov:
os.system( ffmpeg + " -i C:\sequence.avi -sameq -r 24 -y C:\sequence.mov")

Not Working: create individual avi's from 3D program...

cut down to correct length:
os.system(ffmpeg + " -i C:\clip.avi -sameq -r 24 -ss " + startTime + " -vframes " + totalFrames + " -y C:\clip.avi" )

concat to avi sequence:
os.system( ffmpeg + ''' -i concat: C:\clip.avi|C:\clip1.avi|C:\clip2.avi -sameq -r 24 -y C:\sequence.avi''' )

convert sequence to mov: os.system( ffmpeg + " -i C:\sequence.avi -sameq -r 24 -y C:\sequence.mov")

convert individual avi's to mov: os.system( ffmpeg + " -i C:\clip.avi-sameq -r 24 -y C:\clip.mov")

Please let me know where I've gone wrong?

Was it helpful?

Solution

Turns ou it was the "-sameq" flag during the cutting process. It was messing up the audio so I just changed

os.system(ffmpeg + " -i C:\clip.avi -sameq -r 24 -ss " + startTime + " -vframes " + totalFrames + " -y C:\clip.avi" )

to

os.system(ffmpeg + " -i C:\clip.avi -sameq -r 24 - acodec pcm_s16le -ss " + startTime + " -vframes " + totalFrames + " -y C:\clip.avi" )

- forcing ffmpeg to use pcm_s16le as the audio codec instead of the out of sync one the -sameq was using...and that fixed it!

Hope this can help someone else.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top