|

Converting Video Files for iPod/iPhone/iPad

We usually have video files in .wmv .mpg .rmvb or .mkv formats. The iPod, iPhone or iPad only accept a limited number of video file types, such as .mov and .mp4. To play these video files in .wmv .mpg or .rmvb format, we should first convert them to .mov or .mp4 files that can played by iTune or other video players on these Apple devices that use the same codec engine. We may possibly convert video files for iPod or iPhone with mplayer/mencoder but it may have some problems, such as the audio and video do not synchronize very well for some videos.ffmpeg can convert video files from various formats to others and most of the time ffmpeg works very well. This post introduces how to convert the video files in common formats (.wmv, .mpg, .rmvb, .mkv, .etc.) to .mp4 format for iPod/iPhone/iPad.

Install ffmpeg

First, we should install the ffmpeg package. The Fedora Linux does not include ffmpeg in its repository for some reasons but the RPM Fusion repository provides it for us. To install the ffmpeg package, [[go:enable-rpmfusion|add RPM Fusion repository first]].

The install the ffmpeg package:

# yum install ffmpeg

Convert video file format with ffmpeg

The basic command to convert video file input.wmv to onput.mp4 is as follows.

# ffmpeg -i input.wmv -strict -2 output.mp4

Or other format (such as .mov) by:

# ffmpeg -i input.wmv -strict -2 output.mov

ffmpeg determines the output video’s format by its file name extersion.

Convert video file format with ffmpeg for iPod/iPhone/iPad

The files in .mp4 format can be played on Apples devices. The iPod/iPhone/iPad have specific resolution, so we need to to convert the video files to a very high resolution since the devices can only display a limited one. We use the iPod generation 2 as the example, its screen resolution is 480×320. Hence, we can only convert the video to this resolution for smaller video file size. Similarly, the bitrate can also be set accordingly. The default one of ffmpeg (200 kb/s) is too low. To improve the quality of the converted video, we can set it to a larger one.

One good configuration for me is:

# ffmpeg -i input.wmv -s 480x320 -b 1000k -strict -2 output.mp4

-s sets the frame size of the video. -b sets the bitrate of the video.

Convert video file format with ffmpeg for iPod/iPhone/iPad in one command

More conveniently, we can form this command to a script convert2mp4.sh:

#!/bin/bash
ffmpeg -i $1 -s 480x320 -b 1000k -strict -2 /tmp/$1.mp4

Each time to convert a video file video.wmv, we can simply run:

$ convert2mp4.sh video.wmv

and the converted file is /tmp/video.wmv.mp4 after the script finishes.

Similar Posts

  • Finding All Available Versions of a Package in Ubuntu

    How to find all available versions of a package in Ubuntu? To list available versions of a package: apt-cache showpkg <package-name> For example, to check all versions of thunderbird: $ sudo apt-cache showpkg thunderbird Package: thunderbird Versions: 1:31.1.1+build1-0ubuntu0.14.04.1 (/var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_trusty-updates_main_binary-amd64_Packages) (/var/lib/apt/lists/security.ubuntu.com_ubuntu_dists_trusty-security_main_binary-amd64_Packages) Description Language: File: /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_trusty_main_binary-amd64_Packages MD5: 68ed1001b79d708ad48956a0c129114d Description Language: en File: /var/lib/apt/lists/archive.ubuntu.com_ubuntu_dists_trusty_main_i18n_Translation-en MD5: 68ed1001b79d708ad48956a0c129114d 1:31.0+build1-0ubuntu0.14.04.1 (/var/lib/dpkg/status)…

  • Chinese Charactor Configuration on Fedora 11

    最新的更新版本请看: Fedora 中文字体设置. 使用Linux时我个人倾向使用英文环境系统,而Fedora11在英文环境下中文字体有时会不太好看,经常遇到需要字体优化美化的问题。 以下是我的配置方案,经测试效果还算不错,解决了Fedora 11 中文字体难看的问题: 方案1:使用uming和ukai字体,即AR PL UMing CN等。 关键是使用的字体包如下: 首先要安装这两个字体: cjkuni-ukai-fonts cjkuni-uming-fonts 然后配置一下~/.fonts.conf文件. 使sans-serif serif monospace字体中文使用uming/ukai即可. 我的.fonts.conf文件可以从这里下载(两种选择, 我喜欢前者): https://github.com/zma/config_files 使用Liberation和uming/ukai字体: .fonts.cofn.liberation 使用dejavu和uming/ukai字体: .fonts.conf.dejavu 下载后放到自己的$HOME下改名为.fonts.conf就可以了。 使用uming字体效果如下(请放大后看效果): 方案2:安装文泉驿字体,这个非常简单,安装相应包即可了。 如果喜欢其它的字体选择性的安装上就可以了,只要注意只安装自己需要的就行了。有人使用微软雅黑字体,首先这是侵权的,其次开源的字体做得其实已经很不错了。 最后将字体平滑选项打开, KDE和gnome都有相关设置方法。 以上内容只是针对使用xft字体系统的设置。对于使用核心字体系统的X程序来说字体依然会出现很丑的情况。 下面是针对emacs的设置方法: 首先需要安装这个字体包: xorg-x11-fonts-misc 注意到在中文系统下emacs的中文显示非常好,而在英文环境中去非常差,我们可以利用这一点,在运行emacs前首先将系统环境设为中文即可。 在~/bin/下建立一文件ema 内容如下: #!/bin/bash rm -f ~/.emacs ln -s ~/.emacs.x ~/.emacs LANG=zh_CN.UTF-8 emacs –fullheight -r $* 然后加入执行权限即可: chmod +x…

4 Comments

    1. Sems ffmpeg is developed quite actively with version 1.0 just released. What’s the benefit from moving to avconv. From its description, seems avconv is faster?

  1. Thanks, tested many ffmpeg posts on many sites, none of them worked.
    The one you posted works like a charm, well done.

Leave a Reply

Your email address will not be published. Required fields are marked *