|

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

  • How to add social icons to Q2A?

    How to add the social share icons to q2a as shown in this site? This site uses the Question2Answer Share plugin: https://github.com/NoahY/q2a-share After installing the plugin by downloading and copying the directory for the plugin to the qa-plugin directory, you can select the networks to share to in ‘Admin -> Plugins’. I see. Thanks! Read…

  • How to force a checkpointing of metadata in HDFS?

    HDFS SecondaraNameNode log shows 2017-08-06 10:54:14,488 ERROR org.apache.hadoop.hdfs.server.namenode.SecondaryNameNode: Exception in doCheckpoint java.io.IOException: Inconsistent checkpoint fields. LV = -63 namespaceID = 1920275013 cTime = 0 ; clusterId = CID-f38880ba-3415-4277-8abf-b5c2848b7a63 ; blockpoolId = BP-578888813-10.6.1.2-1497278556180. Expecting respectively: -63; 263120692; 0; CID-d22222fd-e28a-4b2d-bd2a-f60e1f0ad1b1; BP-622207878-10.6.1.2-1497242227638. at org.apache.hadoop.hdfs.server.namenode.CheckpointSignature.validateStorageInfo(CheckpointSignature.java:134) at org.apache.hadoop.hdfs.server.namenode.SecondaryNameNode.doCheckpoint(SecondaryNameNode.java:531) at org.apache.hadoop.hdfs.server.namenode.SecondaryNameNode.doWork(SecondaryNameNode.java:395) at org.apache.hadoop.hdfs.server.namenode.SecondaryNameNode$1.run(SecondaryNameNode.java:361) at org.apache.hadoop.security.SecurityUtil.doAsLoginUserOrFatal(SecurityUtil.java:415) at org.apache.hadoop.hdfs.server.namenode.SecondaryNameNode.run(SecondaryNameNode.java:357) It seems the checkpoint…

  • | |

    Release Notes For Linux v2.0

    This is the release notes for linux release v2.0 (source code: linux-2.0.tar.gz) with format adjusted by removing/replacing tabs/spaces/new lines/formatting marks. This notes document can give us an understanding of the early development of the Linux kernel. The original ASCII formatted version is at the end of this post. Intro This document contains a list of…

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 *