[FFmpeg-user] Problem converting MPEGTS file to QuickTime compatible MP4
Bryan Murphy
bmurphy1976 at gmail.com
Sat Apr 16 03:39:47 CEST 2011
I'm having difficulty converting an h.264+aac MPEGTS file into a
QuickTime compatible MP4. If I use ffmpeg to convert a source file
direct to MP4, everything works. If I convert to an intermediate
MPEGTS file (I have multiple reasons for wanting to do this), the
second conversion from MPEGTS to MP4 produces a file that QuickTime
refuses to play.
I've tried multiple versions of ffmpeg and they all seem to exhibit
the same (or very similar) behavior.
Here is a shell script that reproduces this behavior. It creates two
files, output-good.mp4 which plays in QuickTime, and output-bad.mp4
which does not.
#!/bin/bash -e
wget http://www.2atoms.com/video/haha/smelly_monkey4.wmv
# create file that works
ffmpeg -y -i smelly_monkey4.wmv \
-vcodec libx264 -vpre baseline -vpre medium -vpre ipod320 -s 320x240
-r 29.97 -b 256k -bt 256k \
-acodec libfaac -ab 64k -ar 22050 -ac 1 output-good.mp4
# transcode audio seperately
ffmpeg -y -i smelly_monkey4.wmv -f wav -acodec pcm_s16le -sameq .temp.audio1.wav
sox .temp.audio1.wav .temp.audio2.wav channels 1 rate 22050 pad 0 30
faac .temp.audio2.wav -b 64 -c 22050 -o .temp.audio.aac
# transcode video seperately
ffmpeg -y -i smelly_monkey4.wmv -vcodec libx264 -vpre baseline -vpre
medium -vpre ipod320 -s 320x240 -r 29.97 -b 256k -bt 256k -an
.temp.video.h264
# store output as a .ts file
ffmpeg -y -shortest -async 1 -i .temp.audio.aac -i .temp.video.h264
-acodec copy -vcodec copy .temp.transcoded.ts
# repackage output into various different containers as needed,
including QuickTime compatible MP4
ffmpeg -y -i .temp.transcoded.ts -acodec copy -vcodec copy output-bad.mp4
More information about the ffmpeg-user
mailing list