Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[HOWTO] High resolution movies for iPod (script included)
View unanswered posts
View posts from last 24 hours

Goto page 1, 2, 3  Next  
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
micmac
l33t
l33t


Joined: 28 Nov 2003
Posts: 996

PostPosted: Fri Dec 21, 2007 10:10 pm    Post subject: [HOWTO] High resolution movies for iPod (script included) Reply with quote

Download the script (avi2mp4.sh) for MP4 conversion from Doom9.

Hi there,

it took me a while to figure out how to encode compatible high resolution (640:480 and the like) files for the iPod Video. In the end it turned out that there's not much to it, really. Here's how to encode videos following the iPod specs. Works for 5G and 5.5G iPods. They need to run a recent firmware, though.
Essential software:
    - mencoder with x264 support
    - normalize
    - faac
    - gpac (at least version 0.4.4, older releases screw up the tags)


Howto:
Encode the video. The following options are mandatory:
Code:
nocabac:vbv_maxrate=1500:vbv_bufsize=244:level_idc=30

The iPods can't handle CABAC which is turned on by the codec by default. Other things not supported by the iPods (8x8dct, b frames) are disabled in the codecs default settings so we don't have to worry about them. The iPod spec sheet says it can only handle up to 1500 kbit/s (for the video part), that's what vbv_maxrate is for. vbv_bufsize is the size over which vbv_maxrate is calculated. We need to set the proper AVC level (level_idc=30) as well.
Note: Maybe vbv_maxrate/vbv_bufsize are not necessary. Maybe keeping the bitrate equal or below 1500 kbit/s is enough. If you try without vbv_maxrate/vbv_bufsize and experience ill behavior during playback please tell us about it.

Anything else is pretty much up to you. Check out the on-line docs of mencoder: Link
Hints: You need progressive video frames and also the iPod can't scale the video's aspect ratio on playback so you have to take care of that while encoding.

Example:
Here's what I used. The x264 settings are the ones suggested by the mencoder docs for high quality x264 encoding with a few adjustments to make it acceptable for iPod's:
Code:
mencoder dvd:// -oac copy -ovc x264 -vf crop=704:360:12:56,scale=640:-10,harddup -ofps 24000/1001 -x264encopts \ pass=1:bitrate=800:nocabac:vbv_maxrate=1500:vbv_bufsize=244:level_idc=30:frameref=2:subq=5:turbo=1:threads=auto -o /dev/null
mencoder dvd:// -oac copy -ovc x264 -vf crop=704:360:12:56,scale=640:-10,harddup -ofps 24000/1001 -x264encopts \ pass=2:bitrate=800:nocabac:vbv_maxrate=1500:vbv_bufsize=244:level_idc=30:frameref=2:subq=5:turbo=1:threads=auto -o movie.avi

Hint: In case your source is interlaced (really interlaced, not telecined!) there's a chance you can get around deinterlacing by using the "field" parameter (-vf field=0,...). What happens when one uses field=0 on interlaced video is that only the first field (out of two per frame) is regarded. Practically this results in the division by two of the vertical resolution. So for instance instead of 576 pixels you get 288, instead of 480 you get 240. That's just fine in case you go for a final resolution of the encoded file that's smaller than that (or equal to it).

Now let's extract the audio to WAVE and afterwards normalize it:
Code:
mplayer -vc null -vo null -ao pcm:fast movie.avi
normalize audiodump.wav

Next we encode the WAVE to VBR AAC-LC (make sure you follow the example and use the .m4a extension). iPod spec says it can handle audio up to 160 kbit/s. -q 80 usually results in 120 kbit/s so that should take care of things:
Code:
faac -o audiodump.m4a -q 80 audiodump.wav

Next: Extract the raw x264 bitstream from the video:
Code:
MP4Box -aviraw video movie.avi

Then we mux the AAC audio and the x264 video data into a shiny new MP4 container and also tag it while we're at it (otherwise the iPod will display an empty line; the file will be playable, though.)
(Hint: You need to specify the real frame rate of the video, otherwise MP4Box assumes 25 fps.)
(WARNING: MP4Box creates temporary files and defaults to the /tmp directory for that. In case the temporary files exceed the space in the directory MP4Box will _not_ throw an error message. It will continue and leave you with a broken file, wondering what the hell just happened. Took me a good part of an afternoon to figure that out. Guess it's time for a bug report. Anyway, you can specify an alternative directory with the -tmp switch.)
Code:
MP4Box -itags name="NAME OF THE MOVIE" -new -add audiodump.m4a -add movie_video.h264:fps=23.976 movie.mp4

Finally you could tell MP4Box to rewrite some stuff to make the file iTunes compatible. I haven't tested if this is really necessary or if the file really works with iTunes. If you don't use iTunes don't do it. Or maybe nowadays iTunes doesn't need it anymore - then don't do it either.
Code:
MP4Box -ipod movie.mp4


But wait, we still have to put the file on the iPod. I use amarok and media-libs/libgpod-0.6.0 for that. Works like a charm.

I hope this is helpful to some!

Regards
micmac


Last edited by micmac on Sat Feb 16, 2008 9:51 am; edited 28 times in total
Back to top
View user's profile Send private message
marrowhk
Apprentice
Apprentice


Joined: 25 Jul 2007
Posts: 250

PostPosted: Sat Dec 22, 2007 9:13 am    Post subject: Reply with quote

Nice, thanks.
_________________
You'll always come back to GENTOOOOOOO ! (Trust me...)
Back to top
View user's profile Send private message
imanassypov
Tux's lil' helper
Tux's lil' helper


Joined: 08 Dec 2005
Posts: 118
Location: Toronto, Canada

PostPosted: Mon Jan 07, 2008 3:24 pm    Post subject: Reply with quote

How do you deal with it if input is a file.avi, rather than a dvd?

Thanks!
_________________
I.M.
Back to top
View user's profile Send private message
micmac
l33t
l33t


Joined: 28 Nov 2003
Posts: 996

PostPosted: Mon Jan 07, 2008 3:57 pm    Post subject: Reply with quote

imanassypov wrote:
How do you deal with it if input is a file.avi, rather than a dvd?

Exactly the same, basically. Except that you don't use dvd:// but instead simply the filename. Any cropping and scaling may be unnecessary.

I'm thinking about writing a shell script to convert AVI files to mp4 for iPods. I know there are already scripts for that, but I haven't found one that scales down to a set bits per pixel value at a given bitrate (which is what I'm after). But until now I didn't find the drive.
Back to top
View user's profile Send private message
imanassypov
Tux's lil' helper
Tux's lil' helper


Joined: 08 Dec 2005
Posts: 118
Location: Toronto, Canada

PostPosted: Mon Jan 07, 2008 5:47 pm    Post subject: Reply with quote

Great!

One more question - can your script convert .iso files, or do those have to be ripped first?


Thanks again!
_________________
I.M.
Back to top
View user's profile Send private message
micmac
l33t
l33t


Joined: 28 Nov 2003
Posts: 996

PostPosted: Tue Jan 08, 2008 9:11 am    Post subject: Reply with quote

imanassypov wrote:
One more question - can your script convert .iso files, or do those have to be ripped first?


I added the script to the first post. It can handle AVI files, nothing else.
Back to top
View user's profile Send private message
micmac
l33t
l33t


Joined: 28 Nov 2003
Posts: 996

PostPosted: Thu Jan 17, 2008 2:27 pm    Post subject: Reply with quote

Hi!
avi2mp4.sh v1.0.6 can handle any file type, AVI restriction is gone. I don't know about ISO images. My guess is if mplayer is able to handle those then avi2mp4.sh should be able to as well.

Regards
micmac
Back to top
View user's profile Send private message
imanassypov
Tux's lil' helper
Tux's lil' helper


Joined: 08 Dec 2005
Posts: 118
Location: Toronto, Canada

PostPosted: Thu Jan 17, 2008 4:55 pm    Post subject: Reply with quote

I tried the scipt, the resulting mp4's for some reason are not accepted by my ipod (g6)
_________________
I.M.
Back to top
View user's profile Send private message
micmac
l33t
l33t


Joined: 28 Nov 2003
Posts: 996

PostPosted: Thu Jan 17, 2008 5:15 pm    Post subject: Reply with quote

imanassypov wrote:
I tried the script, the resulting mp4's for some reason are not accepted by my ipod (g6)

Meaning the transfer works but the iPod doesn't play the movie or meaning the transfer doesn't work? How do you transfer the file? Did you read the comments within the script regarding iTunes?
Back to top
View user's profile Send private message
micmac
l33t
l33t


Joined: 28 Nov 2003
Posts: 996

PostPosted: Fri Jan 18, 2008 2:08 am    Post subject: Reply with quote

Code:
1.0.8: - Remove myidentify log when skipping file
       - Use rm -f
       - Add possibility to add options to mencoder calls through
         $MENCODER_OPTS


Last edited by micmac on Wed Jan 30, 2008 7:37 am; edited 1 time in total
Back to top
View user's profile Send private message
micmac
l33t
l33t


Joined: 28 Nov 2003
Posts: 996

PostPosted: Tue Jan 29, 2008 9:16 pm    Post subject: Reply with quote

Code:
1.0.9: - In case aspect ratio is not set simply assume Width:Height
       - Add -endpos .1 to myidentify to prevent playback of audio
         files; thanks to Reimar Doeffinger for the tip
       - Check $VFOPTS for cropping; if detected calculate new aspect
         ratio so we get a proper output resolution
1.1.0: - Remove bogus comma from sed call (BASENAME="...")
       - Remove redundant scale command from bc call
       - Check for (and prevent) upscaling of video
       - Lower the bitrate with regards to BPP
       - Move crop detection around
       - Update crop detection for special cases w=0 and h=0; this
         also fixes a potential division by zero
       - Update comments
       - Add CH and CW to function c so both get unset
       - Dimension -> Resolution
       - Display $CW x $CH as resolution if available
       - Make sure ID_VIDEO_WIDTH, ID_VIDEO_HEIGHT, ID_VIDEO_FPS and
         ID_AUDIO_NCH aren't negative
       - Fix the for loop that looks at output resolutions
1.1.1: - Fix behaviour when supplied cropping values are bogus
1.1.2: - Another attempt to correct the behaviour in case of bogus
         crop values; only accept numbers and let mencoder do the
         dying
       - Change loop expression in c-style for-loop once more just for
         correctness' sake
Back to top
View user's profile Send private message
beatryder
Veteran
Veteran


Joined: 08 Apr 2005
Posts: 1138

PostPosted: Thu Jan 31, 2008 11:08 pm    Post subject: Reply with quote

Please update your requirements. You forgot to mention that aacgain needs to be installed.
_________________
Dont make it idiot proof, make it work.
Neucode.org
<suppressed key>
Back to top
View user's profile Send private message
micmac
l33t
l33t


Joined: 28 Nov 2003
Posts: 996

PostPosted: Fri Feb 01, 2008 1:56 am    Post subject: Reply with quote

Hi!

Yeah it's a little confusing. In the "HowTo" I wrote about using normalize to level the audio and in the script I use aacgain. Sorry for that. In the script aacgain is already mentioned as a requirement, though, see the comments.

mic
Back to top
View user's profile Send private message
micmac
l33t
l33t


Joined: 28 Nov 2003
Posts: 996

PostPosted: Sat Feb 16, 2008 9:52 am    Post subject: Reply with quote

Code:
1.1.3: - Direct error messages to stderr
       - Minor comment fix
       - If there's a ".p" file treat video as progressive
       - Users can add mencoder options on a per-file basis
       - Add tip about DVD ripping
       - Add clear_variables function
Back to top
View user's profile Send private message
lyallp
Veteran
Veteran


Joined: 15 Jul 2004
Posts: 1557
Location: Adelaide/Australia

PostPosted: Thu Mar 13, 2008 11:13 pm    Post subject: Reply with quote

I found the script to be quite useful and works quite well.

My only problem is that occasionally, something goes wrong with extracting the audio and a step fails with a missing file.
I have not looked too closely at this just yet and have not figured out the common factor, but if I do, I will let you know.
_________________
...Lyall
Back to top
View user's profile Send private message
micmac
l33t
l33t


Joined: 28 Nov 2003
Posts: 996

PostPosted: Fri Mar 14, 2008 7:33 am    Post subject: Reply with quote

Hi lyallp!

Please check what step fails exactly. Is it mplayer? Or is is MP4Box? In case of MP4Box try this. Emerge it without any "-OX" option in your CFLAGS. E.g.
Code:

CFLAGS="-march=k8 -msse3 -pipe -fomit-frame-pointer"

instead of
Code:

CFLAGS="-march=k8 -msse3 -pipe -fomit-frame-pointer -O2"

I filed a bug already

Regards
micmac
Back to top
View user's profile Send private message
lyallp
Veteran
Veteran


Joined: 15 Jul 2004
Posts: 1557
Location: Adelaide/Australia

PostPosted: Sat Mar 15, 2008 10:22 am    Post subject: Reply with quote

The problem seems to be in mplayer.

Investigation continues, but it appears that the Output PCM filename, in the extract stage, is truncated at the comma. The resulting output is...


[/code]
==========================================================================
Opening audio decoder: [mp3lib] MPEG layer-2, layer-3
AUDIO: 48000 Hz, 2 ch, s16le, 128.0 kbit/8.33% (ratio: 16000->192000)
Selected audio codec: [mp3] afm: mp3lib (mp3lib MPEG layer-2, layer-3)
==========================================================================
[AO PCM] File: /tmp/MovieNameUpTillComma (WAVE)


I am thinking that we should create our temporary names using, say, "avi2mp4_$$.avi", or maybe filter the filenames for things like commas, colons, etc, so mplayer does not get confused.

FYI: I have tweaked my copy of the script, I am happy to email it to the author.
_________________
...Lyall
Back to top
View user's profile Send private message
micmac
l33t
l33t


Joined: 28 Nov 2003
Posts: 996

PostPosted: Mon Mar 17, 2008 5:58 am    Post subject: Reply with quote

Please do!
Back to top
View user's profile Send private message
lyallp
Veteran
Veteran


Joined: 15 Jul 2004
Posts: 1557
Location: Adelaide/Australia

PostPosted: Mon Mar 17, 2008 6:23 am    Post subject: Reply with quote

Changes included in my copy of the script include (noted in the mod log) in the copy sent to the author (for those that are interested).

1. Temporary files (that are used by mplayer) use Process ID as their name, not the original source file - the reason is mplayer, during audio extract, would truncate the filename at a comma (if there was one), resulting in 'no file found' failures.
2. Continue processing other files if one fails - particularly handy if converting lots of files and you come back next day and find it failed on the second.
3. Hard coded the iPod Nano screen size into the conversion (the Nano can take up up to 640x480 but it's screen size is 340x240 - meaning any video file with a larger size is wasted - this makes for smaller video files

I found this script to be really useful and am extremely grateful to the author for making it available.

(well, I am extremely grateful to all open source authors)

Thank you
_________________
...Lyall
Back to top
View user's profile Send private message
bosele
Tux's lil' helper
Tux's lil' helper


Joined: 02 Apr 2005
Posts: 90

PostPosted: Mon Mar 17, 2008 9:13 pm    Post subject: Reply with quote

I wonder if you would able to add a switch to enable video encoding with mpeg4, the reason being that although this script produces great quality video it's extremely slow. Usually this is not a big problem, but it is a bit overkill for converting .flv's from youtube for example. at the moment I just use another clunky script i made for lower quality vids (which basically does this:ffmpeg -i $filein -f mp4 -vcodec mpeg4 -maxrate 1000k -b 600k -qmin 3 -qmax 5 -bufsize 1048576 -g 300 -acodec libfaac -ar 44100 -ab 128k $newname.mp4), but since i am not that great at scripting it has all kinds of problems (doesn't correctly process certain filenames etc.) and i really like the audio normalization your script uses.

anyway, i'd be very gratefull if you would consider adding a switch like this.
Back to top
View user's profile Send private message
lyallp
Veteran
Veteran


Joined: 15 Jul 2004
Posts: 1557
Location: Adelaide/Australia

PostPosted: Tue Mar 18, 2008 1:27 am    Post subject: Reply with quote

What I am trying to find out how to do now is how to get gpac to write the appropriate tags for converted movies.
I found in the MP4Box changelog.
Code:

Tagging can be done with MP4Box -itags option. The tags are passed in a single string, separated by ':', formatted as 'tag_name=tag_value'. Supported tags names are: album, artist, comment, compilation, composer, created, disk, encoder, genre, name, tempo, track, tracknum, writer.


This does not include the tags that iTunes seems to use for Movie/TV Show/Podcast.

Also, I name my videos 'SxxExx - title - series name' which is not useful on the iPod as different shows blend together in a horrible mess (since it does not appear to support directories), hence I think I will be using the -'itags "name=series name - SxxExx - title"'

Further experimentation on this is required :-)
_________________
...Lyall
Back to top
View user's profile Send private message
micmac
l33t
l33t


Joined: 28 Nov 2003
Posts: 996

PostPosted: Wed Mar 19, 2008 6:28 pm    Post subject: Reply with quote

I received your mail, thank you! At the moment I'm moving so I'm a little caught up. I'll take a look when I get around to it.

Regards
mic
Back to top
View user's profile Send private message
micmac
l33t
l33t


Joined: 28 Nov 2003
Posts: 996

PostPosted: Thu Apr 03, 2008 10:01 am    Post subject: Reply with quote

Hi all,

new version of the script released (see link to doom9 forum thread in top post):
Code:
1.1.4: - Add possiblity to set maximum output resolution, thanks to
         L. Pearce for the idea; see comments regarding $MAX_RES
       - Changed comments regarding MP4Box crashes (added suggestion
         for real workaround)
Back to top
View user's profile Send private message
m@o
Apprentice
Apprentice


Joined: 25 Nov 2003
Posts: 184
Location: /eu/at/grz

PostPosted: Sun Apr 13, 2008 1:05 pm    Post subject: Reply with quote

hey!

thanks for the script it works well.

but there are 2 problems i couldn't solve:
Problem 1:
i tried to convert .ts files, which are tv recordings. this works. since there is mostly junk in the beginning and junk at the end i have to trim the files after conversion. there is the problem.
e.g.
Code:
mencoder -ovc copy -oac copy -ss 00:03:30 -endpos 01:40:32 myfile.mp4 -o myfile_cut.mp4

gives problem with the audio.
the video seems fine, but whenever i jump in the video the audio starts at the beginning of the whole file.

any clues what this might be?

Problem 2:
sometimes the tv stations send the movies in two languages. this works fine to watch and change language in mplayer by pressing shift+3 (#). but i cann't select the audio in the command line. neither in mplayer nor in mencoder or the MENCODER_OPTS. where can i find out about which audio streams are available? i did try to read something out of the -v option but that didn't help.
here is an example of the output of a file:
Code:
% mplayer -v /mnt/dvr/movie/some_film.ts
MPlayer dev-SVN-rUNKNOWN-4.1.2 (C) 2000-2008 MPlayer Team
CPU: AMD Athlon(tm) 64 X2 Dual Core Processor 4200+ (Family: 15, Model: 75, Stepping: 2)
MMX2 supported but disabled
SSE supported but disabled
3DNow supported but disabled
3DNowExt supported but disabled
CPUflags:  MMX: 1 MMX2: 0 3DNow: 0 3DNow2: 0 SSE: 0 SSE2: 1
Compiled for x86 CPU with extensions: MMX SSE2
get_path('codecs.conf') -> '/home/mao/.mplayer/codecs.conf'
Reading /home/mao/.mplayer/codecs.conf: Can't open '/home/mao/.mplayer/codecs.conf': No such file or directory
Reading /etc/mplayer/codecs.conf: Can't open '/etc/mplayer/codecs.conf': No such file or directory
Using built-in default codecs.conf.
Configuration: --cc=i686-pc-linux-gnu-gcc --host-cc=i686-pc-linux-gnu-gcc --prefix=/usr --confdir=/etc/mplayer --datadir=/usr/share/mplayer --libdir=/usr/lib --enable-menu --enable-network --disable-tv-bsdbt848 --disable-faad-external --disable-ivtv --disable-pvr --disable-fribidi --disable-enca --disable-nemesi --disable-vstream --disable-libcdio --disable-ass --charset=UTF-8 --disable-lirc --disable-lircc --disable-joystick --disable-inet6 --disable-unrarexec --disable-rtc --disable-tv-v4l2 --disable-tv-teletext --disable-radio-v4l2 --disable-radio-bsdbt848 --disable-live --disable-mad --disable-musepack --disable-pnm --disable-speex --disable-tga --disable-theora --disable-xanim --disable-libamr_nb --disable-libamr_wb --disable-libdca --disable-liblzo --disable-twolame --disable-toolame --disable-real --enable-win32dll --disable-directfb --disable-ggi --disable-md5sum --disable-sdl --disable-xinerama --disable-dga1 --disable-dga2 --disable-vesa --disable-vidix-internal --disable-vidix-external --disable-vidix-pcidb --disable-zr --enable-gui --disable-xvmc --disable-3dfx --disable-tdfxvid --disable-tdfxfb --disable-arts --disable-esd --disable-jack --disable-ladspa --disable-nas --disable-pulse --disable-3dnow --disable-3dnowext --disable-mmxext --disable-sse --disable-ssse3 --disable-altivec
CommandLine: '-v' '/mnt/dvr/movie/some_film.ts'
init_freetype
Using MMX Optimized OnScreenDisplay
Using nanosleep() timing
get_path('input.conf') -> '/home/mao/.mplayer/input.conf'
Can't open input config file /home/mao/.mplayer/input.conf: No such file or directory
Can't open input config file /etc/mplayer/input.conf: No such file or directory
Falling back on default (hardcoded) input config
get_path('some_film.ts.conf') -> '/home/mao/.mplayer/some_film.ts.conf'

Playing /mnt/dvr/movie/some_film.ts.
get_path('sub/') -> '/home/mao/.mplayer/sub/'
[file] File size is 2205990120 bytes
STREAM: [file] /mnt/dvr/movie/some_film.ts
STREAM: Description: File
STREAM: Author: Albeu
STREAM: Comment: based on the code from ??? (probably Arpi)
LAVF_check: MPEG2 transport stream format
Checking for YUV4MPEG2
ASF_check: not ASF guid!
Checking for NuppelVideo
Checking for REAL
Checking for SMJPEG
Searching demuxer type for filename /mnt/dvr/movie/some_film.ts ext: .ts
Checking for Nullsoft Streaming Video
Checking for MOV
Checking for VIVO
header block 1 size: 64
AVS: avs_check_file - attempting to open file /mnt/dvr/movie/some_film.ts
AVS: File is too big, aborting...
Checking for PVA
Checking for MPEG-TS...
TRIED UP TO POSITION 0, FOUND 47, packet_size= 188, SEEMS A TS? 1
GOOD CC: 31, BAD CC: 0
TS file format detected.
DEMUX OPEN, AUDIO_ID: -1, VIDEO_ID: -1, SUBTITLE_ID: -2,
Checking for MPEG-TS...
TRIED UP TO POSITION 0, FOUND 47, packet_size= 188, SEEMS A TS? 1
GOOD CC: 31, BAD CC: 0
PROBING UP TO 0, PROG: 0
COLLECT_SECTION, start: 64, size: 184, collected: 0
SKIP: 0+1, TID: 0, TLEN: 13, COLLECTED: 184
PARSE_PAT: section_len: 13, section 0/0
PROG: 225 (1-th of 1), PMT: 108
COLLECT_SECTION, start: 64, size: 184, collected: 0
SKIP: 0+1, TID: 2, TLEN: 100, COLLECTED: 184
FILL_PMT(prog=225), PMT_len: 184, IS_START: 64, TS_PID: 108, SIZE=184, M=0, ES_CNT=0, IDX=0, PMT_PTR=0x898c830
PROG DESCR, TAG=9, LEN=6(6)
PROG DESCR, TAG=9, LEN=6(6)
PROG DESCR, TAG=9, LEN=6(6)
PROG DESCR, TAG=9, LEN=6(6)
PROG DESCR, TAG=9, LEN=6(6)
ERROR, descriptor len is too long, skipping
...descr id: 0x52, len=1
PARSE_PMT(225 INDEX 0), STREAM: 0, FOUND pid=0xcff (3327), type=0x10000002, ES_DESCR_LENGTH: 3, bytes left: 45
...descr id: 0xa, len=4
Language Descriptor: deu
...descr id: 0x52, len=1
PARSE_PMT(225 INDEX 1), STREAM: 1, FOUND pid=0xd00 (3328), type=0x50, ES_DESCR_LENGTH: 9, bytes left: 31
...descr id: 0x52, len=1
...descr id: 0xa, len=4
Language Descriptor: deu
PARSE_PMT(225 INDEX 2), STREAM: 2, FOUND pid=0xd01 (3329), type=0x50, ES_DESCR_LENGTH: 9, bytes left: 17
...descr id: 0xa, len=4
Language Descriptor: deu
...descr id: 0x6a, len=1
...descr id: 0x52, len=1
PARSE_PMT(225 INDEX 3), STREAM: 3, FOUND pid=0xd03 (3331), type=0x2000, ES_DESCR_LENGTH: 12, bytes left: 0
----------------------------
COLLECT_SECTION, start: 64, size: 184, collected: 184
SKIP: 0+1, TID: 0, TLEN: 13, COLLECTED: 184
PARSE_PAT: section_len: 13, section 0/0
PROG: 225 (1-th of 1), PMT: 108
COLLECT_SECTION, start: 64, size: 184, collected: 184
SKIP: 0+1, TID: 2, TLEN: 100, COLLECTED: 184
FILL_PMT(prog=225), PMT_len: 184, IS_START: 64, TS_PID: 108, SIZE=184, M=0, ES_CNT=4, IDX=0, PMT_PTR=0x898c830
PROG DESCR, TAG=9, LEN=6(6)
PROG DESCR, TAG=9, LEN=6(6)
PROG DESCR, TAG=9, LEN=6(6)
PROG DESCR, TAG=9, LEN=6(6)
PROG DESCR, TAG=9, LEN=6(6)
ERROR, descriptor len is too long, skipping
...descr id: 0x52, len=1
PARSE_PMT(225 INDEX 0), STREAM: 0, FOUND pid=0xcff (3327), type=0x10000002, ES_DESCR_LENGTH: 3, bytes left: 45
...descr id: 0xa, len=4
Language Descriptor: deu
...descr id: 0x52, len=1
PARSE_PMT(225 INDEX 1), STREAM: 1, FOUND pid=0xd00 (3328), type=0x50, ES_DESCR_LENGTH: 9, bytes left: 31
...descr id: 0x52, len=1
...descr id: 0xa, len=4
Language Descriptor: deu
PARSE_PMT(225 INDEX 2), STREAM: 2, FOUND pid=0xd01 (3329), type=0x50, ES_DESCR_LENGTH: 9, bytes left: 17
...descr id: 0xa, len=4
Language Descriptor: deu
...descr id: 0x6a, len=1
...descr id: 0x52, len=1
PARSE_PMT(225 INDEX 3), STREAM: 3, FOUND pid=0xd03 (3331), type=0x2000, ES_DESCR_LENGTH: 12, bytes left: 0
----------------------------
COLLECT_SECTION, start: 64, size: 184, collected: 184
SKIP: 0+1, TID: 0, TLEN: 13, COLLECTED: 184
PARSE_PAT: section_len: 13, section 0/0
PROG: 225 (1-th of 1), PMT: 108
COLLECT_SECTION, start: 64, size: 184, collected: 184
SKIP: 0+1, TID: 2, TLEN: 100, COLLECTED: 184
FILL_PMT(prog=225), PMT_len: 184, IS_START: 64, TS_PID: 108, SIZE=184, M=0, ES_CNT=4, IDX=0, PMT_PTR=0x898c830
PROG DESCR, TAG=9, LEN=6(6)
PROG DESCR, TAG=9, LEN=6(6)
PROG DESCR, TAG=9, LEN=6(6)
PROG DESCR, TAG=9, LEN=6(6)
PROG DESCR, TAG=9, LEN=6(6)
ERROR, descriptor len is too long, skipping
...descr id: 0x52, len=1
PARSE_PMT(225 INDEX 0), STREAM: 0, FOUND pid=0xcff (3327), type=0x10000002, ES_DESCR_LENGTH: 3, bytes left: 45
...descr id: 0xa, len=4
Language Descriptor: deu
...descr id: 0x52, len=1
PARSE_PMT(225 INDEX 1), STREAM: 1, FOUND pid=0xd00 (3328), type=0x50, ES_DESCR_LENGTH: 9, bytes left: 31
...descr id: 0x52, len=1
...descr id: 0xa, len=4
Language Descriptor: deu
PARSE_PMT(225 INDEX 2), STREAM: 2, FOUND pid=0xd01 (3329), type=0x50, ES_DESCR_LENGTH: 9, bytes left: 17
...descr id: 0xa, len=4
Language Descriptor: deu
...descr id: 0x6a, len=1
...descr id: 0x52, len=1
PARSE_PMT(225 INDEX 3), STREAM: 3, FOUND pid=0xd03 (3331), type=0x2000, ES_DESCR_LENGTH: 12, bytes left: 0
----------------------------
COLLECT_SECTION, start: 64, size: 184, collected: 184
SKIP: 0+1, TID: 0, TLEN: 13, COLLECTED: 184
PARSE_PAT: section_len: 13, section 0/0
PROG: 225 (1-th of 1), PMT: 108
COLLECT_SECTION, start: 64, size: 184, collected: 184
SKIP: 0+1, TID: 2, TLEN: 100, COLLECTED: 184
FILL_PMT(prog=225), PMT_len: 184, IS_START: 64, TS_PID: 108, SIZE=184, M=0, ES_CNT=4, IDX=0, PMT_PTR=0x898c830
PROG DESCR, TAG=9, LEN=6(6)
PROG DESCR, TAG=9, LEN=6(6)
PROG DESCR, TAG=9, LEN=6(6)
PROG DESCR, TAG=9, LEN=6(6)
PROG DESCR, TAG=9, LEN=6(6)
ERROR, descriptor len is too long, skipping
...descr id: 0x52, len=1
PARSE_PMT(225 INDEX 0), STREAM: 0, FOUND pid=0xcff (3327), type=0x10000002, ES_DESCR_LENGTH: 3, bytes left: 45
...descr id: 0xa, len=4
Language Descriptor: deu
...descr id: 0x52, len=1
PARSE_PMT(225 INDEX 1), STREAM: 1, FOUND pid=0xd00 (3328), type=0x50, ES_DESCR_LENGTH: 9, bytes left: 31
...descr id: 0x52, len=1
...descr id: 0xa, len=4
Language Descriptor: deu
PARSE_PMT(225 INDEX 2), STREAM: 2, FOUND pid=0xd01 (3329), type=0x50, ES_DESCR_LENGTH: 9, bytes left: 17
...descr id: 0xa, len=4
Language Descriptor: deu
...descr id: 0x6a, len=1
...descr id: 0x52, len=1
PARSE_PMT(225 INDEX 3), STREAM: 3, FOUND pid=0xd03 (3331), type=0x2000, ES_DESCR_LENGTH: 12, bytes left: 0
----------------------------
VIDEO MPEG2(pid=3327) AUDIO A52(pid=3331) NO SUBS (yet)!  PROGRAM N. 225
==> Found video stream: 0

ADDED VIDEO PID 3327, type: 10000002 stream n. 0
==> Found audio stream: 0

ADDED AUDIO PID 3331, type: 2000 stream n. 0
Opened TS demuxer, audio: 2000(pid 0), video: 10000002(pid 0)...POS=10904, PROBE=0
Searching for sequence header... COLLECT_SECTION, start: 64, size: 184, collected: 0
SKIP: 0+1, TID: 0, TLEN: 13, COLLECTED: 184
PARSE_PAT: section_len: 13, section 0/0
PROG: 225 (1-th of 1), PMT: 108
COLLECT_SECTION, start: 64, size: 184, collected: 0
SKIP: 0+1, TID: 2, TLEN: 100, COLLECTED: 184
FILL_PMT(prog=225), PMT_len: 184, IS_START: 64, TS_PID: 108, SIZE=184, M=0, ES_CNT=4, IDX=0, PMT_PTR=0x898c830
PROG DESCR, TAG=9, LEN=6(6)
PROG DESCR, TAG=9, LEN=6(6)
PROG DESCR, TAG=9, LEN=6(6)
PROG DESCR, TAG=9, LEN=6(6)
PROG DESCR, TAG=9, LEN=6(6)
ERROR, descriptor len is too long, skipping
...descr id: 0x52, len=1
PARSE_PMT(225 INDEX 0), STREAM: 0, FOUND pid=0xcff (3327), type=0x10000002, ES_DESCR_LENGTH: 3, bytes left: 45
...descr id: 0xa, len=4
Language Descriptor: deu
...descr id: 0x52, len=1
PARSE_PMT(225 INDEX 1), STREAM: 1, FOUND pid=0xd00 (3328), type=0x50, ES_DESCR_LENGTH: 9, bytes left: 31
...descr id: 0x52, len=1
...descr id: 0xa, len=4
Language Descriptor: deu
PARSE_PMT(225 INDEX 2), STREAM: 2, FOUND pid=0xd01 (3329), type=0x50, ES_DESCR_LENGTH: 9, bytes left: 17
...descr id: 0xa, len=4
Language Descriptor: deu
...descr id: 0x6a, len=1
...descr id: 0x52, len=1
PARSE_PMT(225 INDEX 3), STREAM: 3, FOUND pid=0xd03 (3331), type=0x2000, ES_DESCR_LENGTH: 12, bytes left: 0
----------------------------
==> Found audio stream: 1

ADDED AUDIO PID 3328, type: 50 stream n. 1
==> Found audio stream: 2

ADDED AUDIO PID 3329, type: 50 stream n. 2
OK!
VIDEO:  MPEG2  720x576  (aspect 3)  25.000 fps  15000.0 kbps (1875.0 kbyte/s)
[V] filefmt:29  fourcc:0x10000002  size:720x576  fps:25.00  ftime:=0.0400
get_path('sub/') -> '/home/mao/.mplayer/sub/'
X11 opening display: :0.0
vo: X11 color mask:  FFFFFF  (R:FF0000 G:FF00 B:FF)
vo: X11 running at 1680x1050 with depth 24 and 32 bpp (":0.0" => local display)
[x11] Detected wm supports NetWM.
[x11] Detected wm supports FULLSCREEN state.
[x11] Detected wm supports ABOVE state.
[x11] Detected wm supports BELOW state.
[x11] Current fstype setting honours FULLSCREEN ABOVE BELOW X atoms
[xv common] Drawing no colorkey.
[xv common] Maximum source image dimensions: 2046x2046
==========================================================================
Opening video decoder: [mpegpes] MPEG 1/2 Video passthrough
VDec: vo config request - 720 x 576 (preferred colorspace: Mpeg PES)
Trying filter chain: vo
Could not find matching colorspace - retrying with -vf scale...
Opening video filter: [scale]
SwScale params: -1 x -1 (-1=no scaling)
Trying filter chain: scale vo
The selected video_out device is incompatible with this codec.
Try appending the scale filter to your filter list,
e.g. -vf spp,scale instead of -vf spp.
VDecoder init failed :(
Opening video decoder: [libmpeg2] MPEG 1/2 Video decoder libmpeg2-v0.4.0b
Selected video codec: [mpeg12] vfm: libmpeg2 (MPEG-1 or 2 (libmpeg2))
==========================================================================
==========================================================================
Opening audio decoder: [liba52] AC3 decoding with liba52
dec_audio: Allocating 3840 bytes for input buffer.
dec_audio: Allocating 6144 + 65536 = 71680 bytes for output buffer.
No accelerated IMDCT transform found
AC3: 2.0 (dolby)  48000 Hz  384.0 kbit/s
A52 flags before a52_frame: 0x2A
A52 flags after a52_frame: 0xA
Using MMX optimized resampler
AUDIO: 48000 Hz, 2 ch, s16le, 384.0 kbit/25.00% (ratio: 48000->192000)
Selected audio codec: [a52] afm: liba52 (AC3-liba52)
==========================================================================
Building audio filter chain for 48000Hz/2ch/s16le -> 0Hz/0ch/??...
[libaf] Adding filter volnorm
ao2: 48000 Hz  2 chans  s16le
audio_setup: using '/dev/dsp' dsp device
audio_setup: using '/dev/mixer' mixer device
audio_setup: using 'pcm' mixer device
audio_setup: sample format: s16le (requested: s16le)
audio_setup: using 2 channels (requested: 2)
audio_setup: using 48000 Hz samplerate (requested: 48000)
audio_setup: frags:  16/16  (4096 bytes/frag)  free:  65536
AO: [oss] 48000Hz 2ch s16le (2 bytes per sample)
AO: Description: OSS/ioctl audio output
AO: Author: A'rpi
Building audio filter chain for 48000Hz/2ch/s16le -> 48000Hz/2ch/s16le...
Starting playback...
Increasing filtered audio buffer size from 0 to 65536
VDec: vo config request - 720 x 576 (preferred colorspace: Planar YV12)
Trying filter chain: vo
VDec: using Planar YV12 as output csp (no 0)
Movie-Aspect is 1.78:1 - prescaling to correct movie aspect.
VO Config (720x576->1024x576,flags=0,'MPlayer',0x32315659)
VO: [xv] 720x576 => 1024x576 Planar YV12
VO: Description: X11/Xv
VO: Author: Gerd Knorr <kraxel@goldbach.in-berlin.de> and others
Xvideo image format: 0x32595559 (YUY2) packed
Xvideo image format: 0x32315659 (YV12) planar
Xvideo image format: 0x59565955 (UYVY) packed
Xvideo image format: 0x30323449 (I420) planar
using Xvideo port 355 for hw scaling
[xv] dx: 0 dy: 0 dw: 1024 dh: 576
*** [vo] Allocating mp_image_t, 720x576x12bpp YUV planar, 622080 bytes
[xv] dx: 328 dy: 237 dw: 1024 dh: 576
*** [vo] Allocating mp_image_t, 720x576x12bpp YUV planar, 622080 bytes
Unicode font: 255 glyphs.064.438 ct:  0.004   2/  2 ??% ??% ??,?% 0 0
Unicode font: 255 glyphs.
*** [vo] Allocating mp_image_t, 720x576x12bpp YUV planar, 622080 bytes
Uninit audio filters...: -0.525 ct: -0.140  40/ 40  7%  0%  0.0% 0 0
[libaf] Removing filter volnorm
Uninit audio: liba52
Uninit video: libmpeg2
vo: uninit ...

Exiting... (Quit)


maybe you could see how to access these audiostreams from the commandline.
i did try:
Code:
-aid NUMBER
but that didn't work at all
Code:
-alang LANG
did work but it seems the stream sets the name for all languages the same. (deu). so mencoder|mplayer selects the first stream that matches. is there a way to force some stream?
i'm clueless.

thanks for any hints
Back to top
View user's profile Send private message
micmac
l33t
l33t


Joined: 28 Nov 2003
Posts: 996

PostPosted: Sun Apr 13, 2008 2:21 pm    Post subject: Reply with quote

Hi,

problem 1 seems to be related to remuxing the file with mplayer (mp4 muxing in mplayer is apparently still buggy). And 2 seems related to the file being a ts file. Here's what I would try. I'd just use an application (for instance vdrsync or PVAStrumento (runs in Wine) to convert the transport stream into a program stream and at the same time I'd cut the file (get rid of advertising etc.). There's also ProjectX (Java) which should definitely work.

Yeah, I'd probably end up using ProjectX to convert and cut (shouldn't take more than a few minutes) and afterwards run avi2mp4.sh on the resulting file. You should be able to choose the audio track you want in ProjectX as well.

Good luck, shouldn't be too tough to figure out
mic


Last edited by micmac on Fri Apr 18, 2008 7:26 pm; edited 1 time in total
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Goto page 1, 2, 3  Next
Page 1 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum