Transcoding with ffmpeg libfaac reduces the audio duration

831 Views Asked by At

I have to transcode a mpegts file: input.ts(H.264 and AAC) So I use the following command line:
ffmpeg -y -i input.ts -acodec libfaac -vcodec copy out.ts
But I find that the duration of output.ts's audio is shorter than that of the input.ts!

If I do the following iterations, the output's audio will be shorter and shorter.

ffmpeg -y -i out.ts -acodec libfaac -vcodec copy out-iter1.ts
ffmpeg -y -i out-iter1.ts -acodec libfaac -vcodec copy out-iter2.ts
ffmpeg -y -i out-iter2.ts -acodec libfaac -vcodec copy out-iter3.ts
ffmpeg -y -i out-iter3.ts -acodec libfaac -vcodec copy out-iter4.ts
ffmpeg -y -i out-iter4.ts -acodec libfaac -vcodec copy out-iter5.ts

My ffmpeg's version is 0.6.6. libfaac's version is 1.28.

input.ts's audio duration is 10.432 seconds. out-iter5.ts's audio duration is 10.56 seconds

And I have also tried ffmpeg with version 0.11. And it makes the audio longer than the original input.

So my question is: how to make sure the output's audio duration is same as the input's audio. Since libfaac will make the audio shorter, how can I compensate for it? (For some reason I can't use -acodec copy directly.) Any suggestions?

0

There are 0 best solutions below