24 Dec

How to make Video on Linux, which can play on iPhone.

imge Creating a video on Linux its very simple. With GNU freeware tools we can make a lot of things, such as adding many video and sound effects, converting video formats to each other. Lets talk about how to make video files, which can play on iPhone.
First we need FFmpeg for encoding video and play with formats. I am using Ubuntu 14.10 and FFmpeg missing from the official repositories in 14.10(only avconv) but its will return with Ubuntu 15.04 Vivid Vervet. Let’s install it from another Repo – ppa:samrog131/ppa.

1
2
3
$ sudo apt-add-repository ppa:samrog131/ppa
$ sudo apt-get update
$ sudo apt-get install ffmpeg-real

Now it’s on /opt/ffmpeg/bin/ffmpeg. You can create symlink if you wont:

1
$ sudo ln -sf /opt/ffmpeg/bin/ffmpeg /usr/bin/ffmpeg

Formats list wich used with FFmpeg:

1
$ ffmpeg -codecs

Now convert files to the mp4, wich can play in iPhone/iPad. I am using this parameters:

1
$ ffmpeg -i source_file.mpg -codec:v libx264 -profile:v high -preset slow -b:v 500k -maxrate 500k -bufsize 1000k -vf scale=-1:480 -threads 0 -codec:a libfdk_aac -b:a 128k output_file.mp4

where “profile:v high” for iPhone 4s,iPad 2 and higher. For iPhone 3GS, iPhone 4, iPad use Main Profile.

You can find this on developer.apple.com and other information about parameters on ffmpeg.org.

Profile Level Devices Options
Baseline 3.0 All devices -profile:v baseline -level 3.0
Baseline 3.1 iPhone 3G/later iPod touch 2nd generation/later -profile:v baseline -level 3.1
Main 3.1 iPad (all versions)/ Apple TV 2 and later/ iPhone 4 and later -profile:v main -level 3.1
Main 4.0 Apple TV 3 and later/ iPad 2 and later/ iPhone 4s and later -profile:v main -level 4.0
High 4.0 Apple TV 3 and later/ iPad 2 and later/ iPhone 4s and later -profile:v high -level 4.0
High 4.1 iPad 2 and later/ iPhone 4s and later/ iPhone 5c and later -profile:v high -level 4.1
High 4.2 iPad Air and later/ iPhone 5s and later -profile:v high -level 4.2

You can create video file with Kdenlive. Its very useful and have many effects to play with videos and sounds. Install it from sunab repositories, not from official repositories (Sound Problem after Rendering because it uses library libmlt6 0.9.2.1. New version use libmlt6 0.9.3 where this bug is fixed.)

1
2
3
$ sudo add-apt-repository ppa:sunab/kdenlive-release
$ sudo apt-get update
$ sudo apt-get install kdenlive

Now we can play with kdenlive. Here is video tutorial about working on Kdenlive.

I have attempted to make “iPhone” profile(Rendering -> Create New Profile) with adding this parameters at the top in to parameter section in the KdenLive – but without success. After rendering it won’t play on iPhone. Only way – it’s making video in KdenLive and then converting it in the terminal with ffmpeg to playable format to iPhone. i will post here any new ideas about it without working in terminal.

Tweet about this on TwitterShare on FacebookShare on Google+Share on RedditShare on VK