Encoding video for Ipod Touch 4th generation

Output format to use

Container: MP4 Video stream encoding: MP4 AVC Max video resolution: 720 (the full 960 pixels can not be used) FPS: 30 Audio: 48kHZ AAC Max audio bitrate: 320 kbps Max total bitstream rate: 14Mbps

DBV-T sources

While the swedish public service television company SVT provides an Iphone app for viewing streams via internet, the quality of such streams are not as good as the DVB-T broadcasting, and at my current location I pay for internet traffic (or rather I have a maximum of some GBs/month for free which I don't want to waste on video data).

I played around with recording video from DBV-T and wanted to view the movie on an Ipod Touch 4g. Recording DBV-T is only a matter of dumping the data - which comes in MPEG-TS format, to file. Such a file has video data in 720x576 @ 25 fps 15000 kbps and audio data as mp3 192 kbps, that is at an extremely high quality. And it comes for free through the air :-)

recording dvb-t video

tzap -r -H -t 5400 -o - 'SVT1 Västnytt' > the.movie.mpeg

The Ipod Touch does not support MPEG-TS, so the video as to be encoded to a supported format. First, fix any audio/video sync problems with projectx

audio/video sync problems

The MPEG-TS files you get when capturing DVB-T have an negative audio offset which must be corrected for. As of 2.5, avidemux, does not handle this automatically, thus projectx is used to get the amount of offset.

A sample file my-cutpoints.Xcl, defining the cuts for a minimal file.

CollectionPanel.CutMode=0
71440
750000
projectx -cut my-cutpoints.Xcl -tom2p -out /media/disk/tv -name foo /media/disk/tv/brooks.mpeg

Now, load foo.m2p into avidemux, choose Audio —> Main Track, and there you see the offset. Choose "shift" and enter the offset.

I use avidemux and choose the following settings

video

sound

container format

ffmpeg

ffmpeg -r 25 -maxrate 10M -b 5M -qmin 3 -qmax 31 -bufsize 4096 -g 300 -aspect 4:3 -f image2 -i '%d.png' -vcodec mpeg4 -s 800x600 chi.mp4

Source: Sony Cybershot

The video recordings are stored in PRIVATE/AVCHD/BDMV/STREAM/.

When opening a file, avidemux will warn

H264 detected
If the file is using B-frames as references it can lead to a crash or stuttering.
Avidemux can use another mode which is safe but YOU WILL LOSE FRAME ACCURACY.
Do you want to use that mode?

Cancel | *Safe Mode*
Choose cancel, then you will be asked
Index is not up to date
You should use Tool->Rebuild frame. Do it now?

No | *Yes*
Choose yes.

11440 11960

Other sources, other tricks. Unsupported audio codecs

Our new digital camera - EASTMAN KODAK COMPANY KODAK EASYSHARE Sport Camera, C123 - produces audio encoded with uLaw, as can be seen from the output of mplayer below:

Opening audio decoder: [alaw] aLaw/uLaw audio decoder
AUDIO: 8000 Hz, 2 ch, s16le, 128.0 kbit/50.00% (ratio: 16000->32000)

This audio codec is not supported by avidemux, so use mplayer to decode the audio to WAVE-format.

mplayer -vo null -vc null -ao pcm:file=100_0025.wav /media/disk/DCIM/100KC123/100_0025.AVI

Also, the audio must be resampled to 48000 Hz from the original 8000 Hz. This can be done in avidemux, in the Filters dialog, choose Resampling, and set it to 48000.

Our first movie was showing the kids jumping from the rocks into the sea, a scene that required quite some bitrate, and I used 5000 kilo bits per second, two phase encoding.

A minimal script for decoding audio from video-clips:

#!/bin/sh

mplayer -vo null -vc null -ao pcm:file=$1.wav $1

10747 114200

comments powered by Disqus


Back to the index

Blog roll

R-bloggers, Debian Weekly
Valid XHTML 1.0 Strict [Valid RSS] Valid CSS! Emacs Muse Last modified: oktober 17, 2019