3
votes

I used below command to convert videos from FLV,M4V to MP4.

ffmpeg -y -i video_1336406262.flv -vcodec libx264 -vpre slow -vpre ipod640 -b 250k -bt 50k -acodec libfaac -ac 2 -ar 48000 -ab 64k -s 480x320 video_1336406262.mp4

The videos converted from M4V to MP4 are playing very well in both iPhone and iPod but the videos converted from FLV to MP4 does not work in iPod but does in iPhone.

In the video area of HTML5 page iPod even does not show the play symbol.

Could someone help here?

I am using the same command to convert from both FLV and M4V to MP4.

Thanks

2
can you post the full outputs of doing a m4v to mp4 conversion and flv to mp4 conversion? please use something like pastebin.com or similar services for the logs and post the link(s) hereben
Using the ipod640 preset -vpre ipod640 makes little sense if you specify the size with -s 480x320Lowip

2 Answers

5
votes

I would recommend using HandBrakeCLI in order to convert videos to MP4.

Handbrake has a few built-in presets that allow precise compatibility targetting, see https://trac.handbrake.fr/wiki/BuiltInPresets

The built-in ipod preset has a few differences with the format you require, so your invocation can be translated to a handrake call in the following way:

HandBrakeCLI -i video_1336406262.flv -e x264 -a 1 -E faac -6 dpl2 -R Auto -D 0.0 -f mp4 -I -m -x level=30:bframes=0:weightp=0:cabac=0:ref=1:vbv-maxrate=768:vbv-bufsize=2000:analyse=all:me=umh:no-fast-pskip=1:subme=6:8x8dct=0:trellis=0 -b 250 -B 64 -R 48 -X 480 -w 480 -l 320 -2 -o video_1336406262.mp4

I can't certify this is exactly what you need, but that should be close enough.

3
votes

The conversion m4v -> mp4 makes no sense. m4v is just another extension for mp4.

Mp4 is not a video format but a wrapper for audio/videos/subtitles/metadatas. In my opinion the problem comes from the profile. Depending on the iPhone generation, not all h264 profiles are supported.

Try adding -coder 0 to your command and it should work.

I think you get your command from here and I noticed there is another command that should do what you want :

iPod-iPhone 640 width, without presset :
ffmpeg -i INPUT -s 640x480 -r 30000/1001 -b 200k -bt 240k -vcodec libx264 coder 0 -bf 0 -refs 1 -flags2 -wpred-dct8x8 -level 30 -maxrate 10M -bufsize 10M-acodec libfaac -ac 2 -ar 48000 -ab 192k output.mp4

According to my experience, if you want a good quality/size ratio, you should prefer 2-pass encoding :

ffmpeg -y -i input -r 30000/1001 -s 480x272 -aspect 480:272 -vcodec libx264 -b 512k -bt 1024k -maxrate 4M -flags +loop -cmp +chroma -me_range 16 -g 300 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -rc_eq "blurCplx^(1-qComp)" -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 -coder 0 -refs 1 -bufsize 4M -level 21 -partitions parti4x4+partp8x8+partb8x8 -subq 5 -f mp4 -pass 1 -an -title "Title" output.mp4

The encoding process is longer but worth the time!

One last thing, instead of using ffmpeg directly, I prefer to use Mencoder which is a wrapper for ffmpeg (more codecs support). A nice GUI for Mencoder should be MeGUI for windows, it really make the encoding process easier!