I have a javascript that records video from a webcam as webm and audio from microphone as wav together. I am encoding these webm and wave files to generate a mp4 file using ffmpeg/avconv. But i've noticed a small differrence in length of audio and length of video which makes the output out of sync.
I tried the async/asyncts option, but i've noticed no differrence in output, still out of sync
ffmpeg -async 1 -y -i audio.wav -i video.webm -vcodec libx264 output.mp4
I tried using areasample filter with avconv gave me error
No such filter: 'areasample'
Error opening filters!
for
avconv -y -i audio.wav -i video.webm -vcodec libx264 -filter "areasample=asyncts:compensate" output.mp4
How can i make the video in sync?
Update:
My audio length is less than that of video. I'm using the command
ffmpeg -itsoffset -00:00:01 -y -i audio.wav -i video.webm -vcodec libx264 output.mp4
to make them in sync. But I'm not sure there will be a 1 sec difference always. So I'm looking for a solution that could manage this dynamically(add the offset for missing audio length).
aresample
(from "re-sample")?asyncts
is another filter, so the syntax looks a little off to me. Can you please include the full, uncut output of both commands?