A bit of googling and reading the man pages later I discovered
-vcodec copy -acodec copy
This tells ffmpeg to copy the video and audio without re-encoding.
So insted of this
ffmpeg -i input.flv output.mp4
The Solution
ffmpeg -i input.flv -vcodec copy -acodec copy output.mp4
Further complications
javascript:void(0)
This worked a treat for all except one file - which gave the following error.
[NULL @ 0x9b6b9f0]error, non monotone timestamps 37464141 >= 37463126
av_interleaved_write_frame(): Error while opening file
By using the "-an" and "-vn" flags to skip the video and audio encoding in turn I narrowed it down to a problem in the audio codec timestream.
To try to get ffmpeg to fix the problem I got it to reencode the audio but copy the video codec with the following:
ffmpeg -i input.flv -vcodec copy -acodec mp2 -ar 44100 -ab 128k output.mp4
Worked a treat. I love ffmpeg
Final code to fix it using aac with audio quality quite high 200 (range is 0-255)
ffmpeg -i input.flv -vcodec copy -acodec libfaac -aq 200 output.mp4
No comments:
Post a Comment