Re: video re-encoding to suit mobile device

elliott-brennan <[email protected]> Mon, 10 Oct 2011 18:39:29 +1100
Newsgroups gmane.org.user-groups.slug.chat
Message-ID <[email protected]>
On 07/10/11 Voytek wrote
> I have a PVR that records TV as a .ts file, apparently it's a raw video
> stream, it's around 2GB for 60 minutes news (non-HD) broadcast, I'd like
> to re-encode to a smaller file size suitable for playing on a 4" mobile
> phone, as well as 10" tablet, either streaming or from file on the device.
>
> target devices are:
> 800x1280 pixels,(~149 ppi pixel density)
> 540 x 960 pixels, (~275 ppi pixel density)
>
> is ffmpeg and/or mencoder what is needed ?
>
> what options should I be using, I'm trying like (what I've found in some
> tutorials):
>
> ffmpeg -i movie.ts -ab 128 -b 10000 movie.mpg
>
> mencoder movie.ts -oac mp3lame -lameopts cbr:mode=2:br=96 -af
> resample=44100 -srate 44100 -ofps 20 -ovc lavc -lavcopts
> vcodec=mpeg4:mbd=2:cbp:trell:vbitrate=300 -vf scale=960:540 -ffourcc XVID
> -o movie1.mpeg
>
> ffmpeg identifies .ts as:
>
> Stream #0.0[0xa2]: Video: mpeg2video, yuv420p, 720x576 [PAR 64:45 DAR
> 16:9], 10000 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
> Stream #0.1[0x53](eng): Audio: mp2, 48000 Hz, 2 channels, s16, 192 kb/s
> Stream #0.2[0x2a](eng): Subtitle: 0x0006
> Stream #0.3[0x1388]: Data: 0x000b
>
> mencoder says:
>
> TS file format detected.
> VIDEO MPEG2(pid=162) AUDIO MPA(pid=83) SUB Teletext(pid=42)  PROGRAM N. 770
> VIDEO:  MPEG2  720x576  (aspect 3)  25.000 fps  10000.0 kbps (1250.0 kbyte/s)
> [V] filefmt:29  fourcc:0x10000002  size:720x576  fps:25.000  ftime:=0.0400
>

Hi Voytek,

There are a few options available, depending on 
whether you wish to use a GUI or not.

The best encoding depends on the device and what 
it is capable of playing (natch).

We have a Beyonwiz PVR which records to .ts files 
also and I've encoded videos to play on our media 
player and mobile phones (Nokia and Galaxy SII).


A) NON-GUI options

From:
http://lukedoomer.blogspot.com/2009_08_01_archive.html

Place the text below (between the line of stars) 
in a file and call it:

mencoder.conf

then place this in /home/<name>/.mplayer/

then run the following command:

mencoder -profile n97 -o <name of output file>.mp4 
<name_of_input file>.vob/whatever (without the 
asterickses)


*********************
[n97]
profile-desc="MPEG4/AAC Medium Quality"
lavdopts=threads=2
vf=pp=md,scale=368:-10,harddup
ovc=lavc=yes
oac=lavc=yes
lavcopts=aglobal=1:vglobal=1:vcodec=mpeg4:vbitrate=1200:acodec=libfaac:abitrate=128
af=lavcresample=24000
ofps=30000/1001
of=lavf=yes
lavfopts=format=psp

**********************************


B) GUI OPTION

The GUI applications below may well be in your repos.

1. WinFF

http://winff.org/html_new/

Works very well and provides the ability to create 
your own scripts as well. I've used it a lot.

2. Arista

http://www.transcoder.org/

Though I had installed it I hadn't tried Arista 
before...so just did. Not bad.

Interface is simple and easy to follow. Speed is 
pretty okay (2.8Ghz quad core with 8G RAM so I 
expect things to go quickly anyway).


3. Avidemux

http://avidemux.sourceforge.net/

This has more options and you may well need to 
play around with them to work out which suits. A 
hint is that to re-encode the video you need to 
select the 'file > save > save video' option after 
making the changes to the filter options.

You'll likely find that with some of these you can 
identify the options they are running and then 
make a script (if that's your thing ;)))

You may find that you get some voice sync probs on 
occasions. It's rare that I do, but you then have 
to fiddle with the offset a bit (if those options 
exist).


Hope some of this helps.

Regards,

Patrick

-- 
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html