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 Previous  1, 2, 3  Next  
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
m@o
Apprentice
Apprentice


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

PostPosted: Sun Apr 13, 2008 6:34 pm    Post subject: Reply with quote

thx

do you have suggestion to cut the movie from problem 1 in a simple way (command line)?

ad prob 2:

thx this seems a little heavy for the everyday use :(
i'll give it a try though.

greetz
m@o
Back to top
View user's profile Send private message
micmac
l33t
l33t


Joined: 28 Nov 2003
Posts: 996

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

Hi,

if you know the times for cutting you can do it with avi2mp4.sh, e.g.:
Code:
-ss 3:00 -endpos 3600

That'd tell mencoder to start 3 minutes within the file and encode the next hour (but you already knew this). Just put it in a file called "mymovie.ts.me" and run the script on mymovie.ts.

I know that it's bothersome sometimes to convert tv captures. I used VDR, for instance, and I had the same experience. But with VDR you can set cut marks which PVAStrumento can use, so it was almost a one-click solution.

Kind regards
micmac
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 10:21 pm    Post subject: Reply with quote

i did try projectx.

nice program. it worked well to cut the ts streams.
but i didn't find an option yet to select a certain audio stream. at the moment it does convert all streams to a new .ts file, which is trimmed to my specifications.

there are two things i need to do:

a) trim the movies
b) select the right audio stream

a) works with projectX, although i would prefer a command line option. a second option would be to use mencoder BEFORE converting the files to mp4 but AFTER converting them from ts to some mpeg2 material.
b) is currently based on luck. i don't know yet how to get the right audio stream when every stream is named the same.

well i think this is no job for just ONE weekend ;)

greetz
m@o
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: Wed Apr 16, 2008 6:04 pm    Post subject: Reply with quote

i hope i can help other out by telling how i got everything to work:

cutting recordings is supereasy and quick in projectX. once you have your default settings you just open it select a file and run. 2-3 minutes later you are done.

so i can live with projectX cutting my ts streams and copying them into shorter ts streams. :wink:

Quote:
b) select the right audio stream


here i guess i was just too dumb! really!
what are the available audio streams here:
Code:
...descr id: 0x56, len=5
...descr id: 0x52, len=1
PARSE_PMT(11 INDEX 0), STREAM: 0, FOUND pid=0x20 (32), type=0xffffffff, ES_DESCR_LENGTH: 10, bytes left: 53
...descr id: 0x52, len=1
PARSE_PMT(11 INDEX 1), STREAM: 1, FOUND pid=0x6ff (1791), type=0x10000002, ES_DESCR_LENGTH: 3, bytes left: 45
...descr id: 0x52, len=1
...descr id: 0xa, len=4
Language Descriptor: deu
PARSE_PMT(11 INDEX 2), STREAM: 2, FOUND pid=0x700 (1792), type=0x50, ES_DESCR_LENGTH: 9, bytes left: 31
...descr id: 0xa, len=4
Language Descriptor: deu
...descr id: 0x52, len=1
PARSE_PMT(11 INDEX 3), STREAM: 3, FOUND pid=0x701 (1793), type=0x50, ES_DESCR_LENGTH: 9, bytes left: 17
...descr id: 0x6a, len=1
...descr id: 0x52, len=1
...descr id: 0xa, len=4
Language Descriptor: deu
PARSE_PMT(11 INDEX 4), STREAM: 4, FOUND pid=0x703 (1795), type=0x2000, ES_DESCR_LENGTH: 12, bytes left: 0

i thought it would be 0x52 or 0xa or 0x6a. well it turns out it was not :oops:

take 0x703 or 1795, 0x700 or 1792, 0x6ff or 1791 and you are fine.
the mencoderflags:
Code:
-aid 1791
or
-aid 0x6ff

would select stream 1.

just put them into film.ts.me for the movie film.ts and the script will add it to the flags.

thanks for your help here
the script works perfectly :D
m@o
Back to top
View user's profile Send private message
micmac
l33t
l33t


Joined: 28 Nov 2003
Posts: 996

PostPosted: Fri Apr 18, 2008 7:22 pm    Post subject: Reply with quote

Hey now!

Thanks for your info. It's interesting to know and it's nice how you figured it out. Also I like that you like my script :D

Kind regards
micmac
Back to top
View user's profile Send private message
G2k
l33t
l33t


Joined: 06 Mar 2004
Posts: 672
Location: Rome, Italy

PostPosted: Sat Apr 26, 2008 1:52 am    Post subject: Reply with quote

hey guys I have an .flv file I downloaded from youtube and I want to convert it to .mp4 for my iPod. What script should I be using I can't seem to find an appropriate one.
Thanks
_________________
Animula vagula blandula,
Hospes comesque corporis,
Quae nunc abibis in loca
Pallidula rigida nudula,
Nec ut soles dabis iocos...
- Imp. Caesar Hadrianus
Back to top
View user's profile Send private message
micmac
l33t
l33t


Joined: 28 Nov 2003
Posts: 996

PostPosted: Sat Apr 26, 2008 7:08 am    Post subject: Reply with quote

avi2mp4.sh doesn't work? If not please post its output. I downloaded a FLV from youtube (25fps) and it worked fine. As long as mplayer can play the file and the framerate is <=30 avi2mp4.sh should work.
Back to top
View user's profile Send private message
G2k
l33t
l33t


Joined: 06 Mar 2004
Posts: 672
Location: Rome, Italy

PostPosted: Sat Apr 26, 2008 8:22 am    Post subject: Reply with quote

it made an .mp4 file that seemingly worked just fine until i got to the end of the video when the audio stopped. This is the output for the audio encoding
Code:
Encoding audio:

Freeware Advanced Audio Coder
FAAC 1.26.1 (Apr 26 2008) UNSTABLE

Quantization quality: 100
Bandwidth: 11025 Hz
Object type: Low Complexity(MPEG-4) + M/S
Container format: MPEG-4 File Format (MP4)
Encoding /home/user/rip/tmp/n5yTatgmsIs_mplayer.wav to /home/user/rip/tmp/n5yTatgmsIs_faac.m4a
   frame          | bitrate | elapsed/estim | play/CPU | ETA
 4929/4929  (100%)|   32.3  |    6.0/6.0    |   37.95x | 0.0


Applying ReplayGain:

/home/user/rip/tmp/n5yTatgmsIs_faac.m4a
No changes to /home/user/rip/tmp/n5yTatgmsIs_faac.m4a are necessary
...but tag needs update: Writing tag information for /home/user/rip/tmp/n5yTatgmsIs_faac.m4a

Extracting raw x264 bitstream from video:

Extracting AVI video (format h264) to /home/user/rip/tmp/n5yTatgmsIs_mencoder_video.h264
                                                   
Muxing:

IsoMedia import - track ID 1 - Audio (SR 22050 - 2 channels)
AVC-H264 import - frame size 320 x 240 at 15.000 FPS     
Import results: 3799 samples - Slices: 26 I 3773 P 0 B - 1 SEI - 26 IDR
Saving /home/user/rip/n5yTatgmsIs.mp4: 0.500 secs Interleaving
                                                       
Cleaning up.

Encoding n5yTatgmsIs.mp4 finished.

File:         Metheny.mp4

Input file does not exist. Skipping.
There doesn't seem to be a problem but the audio just stops a few second before the clip ends. Any idea why?
_________________
Animula vagula blandula,
Hospes comesque corporis,
Quae nunc abibis in loca
Pallidula rigida nudula,
Nec ut soles dabis iocos...
- Imp. Caesar Hadrianus
Back to top
View user's profile Send private message
micmac
l33t
l33t


Joined: 28 Nov 2003
Posts: 996

PostPosted: Sat Apr 26, 2008 3:55 pm    Post subject: Reply with quote

Hi,

I checked my file for missing audio towards the end and I have the same issue. Can't tell what's wrong, though.
Back to top
View user's profile Send private message
micmac
l33t
l33t


Joined: 28 Nov 2003
Posts: 996

PostPosted: Sun Jun 15, 2008 7:58 pm    Post subject: Reply with quote

Code:
1.1.5: - Add $MP4BOX_IPOD to set whether "MP4Box -ipod ..." is run
       - Add possibility to renice the script (alter its priority)
       - use "-oac pcm" instead of "-oac copy"; it does add a little
         overhead (and we need more drive space) but it helps keeping
         audio and video in sync; also some audio codecs cannot be
         muxed into AVI, e.g. Vorbis, so now we're working around this
         issue


@G2k: This should fix the sync issues we experienced e.g. with YouTube files
Back to top
View user's profile Send private message
micmac
l33t
l33t


Joined: 28 Nov 2003
Posts: 996

PostPosted: Thu Jun 26, 2008 5:09 pm    Post subject: Reply with quote

Code:
1.1.6:
        - Split release into ChangeLog, README, INSTALL and script itself
        - Add possibility to use neroAacEnc AAC encoder instead of faac; it's
          not Open Source but I ran into an issue with faac earlier and
          apparently it's not maintained anymore
        - Increase accuracy of aspect calculation; I doubt this has any effect
Back to top
View user's profile Send private message
brfsa
Tux's lil' helper
Tux's lil' helper


Joined: 01 Aug 2005
Posts: 121
Location: Brazil

PostPosted: Mon Jun 30, 2008 1:27 am    Post subject: Thanks! Reply with quote

Thanks for this great script, works like a charm.

I am planning to buy an Ipod classic 6th Gen.
u said it is good for 5/5.5Gen.

Anyone tested the videos on a 6th Gen IPOD Classic?

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


Joined: 28 Nov 2003
Posts: 996

PostPosted: Mon Jun 30, 2008 5:45 am    Post subject: Reply with quote

Glad you like it!

6th (classic) works fine.
Back to top
View user's profile Send private message
brfsa
Tux's lil' helper
Tux's lil' helper


Joined: 01 Aug 2005
Posts: 121
Location: Brazil

PostPosted: Fri Jul 04, 2008 6:42 pm    Post subject: Reply with quote

Hi all, I have been using it to convert some youtube flv files.

You need to mark media-video/gpac stable, because the 0.4.4 has the "-ipod" option.

# echo "media-video/gpac" >> /etc/portage/package.keywords



what are the options are you guys using for youtube flv files?

the flv files I downloaded are :
Video: 320x240 24bpp 29.970 fps, video_bitrate: 285kbps (found from from gxine stream_info)
Audio: 64kbps, 22050Hz, stereo.

And these are the settings for avi2mp4:

MAX_BITRATE="400"
BPP="0.18"
USE_NERO_AAC=""
FAAC_ENCOPTS=" -b 64 -c 22050 "
NAAC_ENCOPTS=""
X264_ENCOPTS=""
MENCODER_OPTS=""
MAX_RES="320x240"
MP4BOX_IPOD="yes"
RENICE=""

I get the output mp4 files 20-30% larger than the flv.
and the video and audio out of sync for 1 or 2 seconds.


Anyone have ideas?
Back to top
View user's profile Send private message
micmac
l33t
l33t


Joined: 28 Nov 2003
Posts: 996

PostPosted: Tue Jul 08, 2008 7:55 am    Post subject: Reply with quote

Code:

1.1.7:
        - mention faac in INSTALL
        - add possibility to override neroAacEnc binary (README for more
          info)
        - add Xvid support; it's so much faster than x264, had to add it
        - add configuration file example to README
Back to top
View user's profile Send private message
micmac
l33t
l33t


Joined: 28 Nov 2003
Posts: 996

PostPosted: Sun Feb 08, 2009 10:34 am    Post subject: Reply with quote

Code:
1.1.8:
   - use random ASCII file names to work around problems with special
     characters (e.g. with MPlayer's pcm writer and gpac)
   - make the script a little bolder ;)
1.1.9:
   - make sure muxing doesn't result in variable video frame rate
   - cleaned up quite a bit (quoting, brackets, ...)
   - better error detection
   - clean user configuration file before sourcing it
   - write initial configuration file
   - got rid of all evals
   - removed hardcoding of iPod-specific encoder options
1.1.10:
   - remove BPP usage
   - add compressibility check
   - delete INSTALL file (put content into README)
   - clean up README
   - (hopefully) last batch of quoting fixes
   - make scripting style more consistent
   - better sed scripts
   - use $HOME instead of "~" expansion
   - move command substitutions out of [tests]
1.1.11:
   - during compressibility test capture mencoder output in a file
     and display content of file in case mencoder exits with an
     error, otherwise user wouldn't know what went wrong
   - used long command options when available
   - don't write/source temporary configuration file
   - don't just source the mplayer -identify output either for that
     matter
   - only load necessary variables from configuration file and
     mplayer's identify output
   - use random name for myidentify output, too
   - set sane PATH, IFS and umask
   - clear all aliases and the command path hash
   - prevent core dumps
   - end shebang line with hyphen
   - changed name of array media_vars to all_media_vars and added
     an array called mplayer_media_vars for clarity's sake
   - made parsing of file for variable a function
   - changed the initial configuration a bit
   - refuse to crop repeatedly
   - demand Bash, version 2 or greater
1.1.12:
   - added subtitle support (SRT, SUB and VobSub)
   - added $TRACK_LANG so user can set a three digit language code.
     It's not _that_ useful because you can not set it on a
     per-file or even-per track basis. Why did I even add it in the
     first place? :D
   - call MP4Box from within the tmp directory do avoid another bug
     (for some reason MP4Box added something like ".idx" to the
     command line otherwise)
   - some small fixes (comments, README)
   - call MP4Box without "-isma" because it removes the subtitles
1.1.13:
   - script now refuses to (try to) convert mpeg containers
   - updated README
Back to top
View user's profile Send private message
micmac
l33t
l33t


Joined: 28 Nov 2003
Posts: 996

PostPosted: Sat Mar 28, 2009 5:55 pm    Post subject: Reply with quote

Code:
1.1.14:
   - now 3GPP text subtitles (.ttxt) are recognized as well
   - new configuration variable SBTL, see README
   - pass TRACK_LANG & video fps along as a global MP4Box argument
   - changed subtitle handling, now for text subtitles the 3GPP
     header is adapted slightly for proper display (I tried to
     follow the findings of this blog entry:
     http://blog.jharding.org/2008/11/subtitles-on-appletv-and-iphone.html
     Thanks for the ideas!)
   - use "-ipod" argument directly when muxing
1.1.15:
   - fix subtitle related mistake
   - set vim modeline
   - some cleanups (in README as well)
Back to top
View user's profile Send private message
sipingal
n00b
n00b


Joined: 12 May 2008
Posts: 62
Location: China

PostPosted: Fri Apr 03, 2009 8:47 am    Post subject: Mencoder is enough Reply with quote

Mencoder is enough. I suggest you use this command to convert video:
I wrote a shell script to convert video for ipod/PSP, it works fine for me. It is freak. I am not going to upload it. :(

For IPOD(my IPOD 5.5g): (If the filename is dvd://1, this command will convert DVD to a IPOD/PSP video file.
Code:
mencoder -dvd-device /dev/dvd <filename> -o <output.mp4> -ofps 25000/1001 -af lavcresample=48000 -vf harddup -oac lavc -lavcopts aglobal=1:acodec=libfaac -ovc x264 -x264encopts global_header:bitrate=200:mixed_refs:ratetol=50:subq=5:nocabac:partitions=i4x4+p8x8+b8x8:me=umh:me_range=16:qcomp=0.6:frameref=5:bframes=0:trellis=1:level_idc=13 -of lavf -lavfopts format=ipod -vf scale=320:240 -alang eng -slang chi -unicode -subfont-encoding unicode -font Consolas -subfont SimHei -subfont-text-scale 3.8 -subcp cp936 -subpos 98


For PSP,
Code:
mencoder -dvd-device /dev/dvd <filename> -o <output.mp4> -ofps 25000/1001 -af lavcresample=48000 -vf harddup -oac lavc -lavcopts aglobal=1:acodec=libfaac -ovc x264 -x264encopts global_header:bitrate=300:ratetol=50:subq=5:partitions=i4x4+p8x8+b8x8:me=umh:me_range=16:qcomp=0.6:frameref=2:trellis=1:bframes=1:b_pyramid:weight_b:chroma_me:level_idc=21 -of lavf -lavfopts format=psp -vf scale=480:272 -alang eng -slang eng -unicode -subfont-encoding unicode -font Consolas -subfont SimHei -subfont-text-scale 2.8 -subcp cp936 -subpos 98


cat ~/.mplayer/mencoder.conf
Code:
[default]
srate=48000
a52drc=1
mc=0.2
slang="ch,chi,tw,en,eng"
fontconfig=yes
font="Consolas"
subfont="SimHei"
subfont-encoding=unicode
unicode=yes
utf8=yes
subcp=cp936
subpos=96
ffactor=0.75
sub-bg-alpha=0
sub-bg-color=0
subfont-autoscale=3
subfont-osd-scale=1.94
subfont-text-scale=1.94
subfont-outline=2.0
subfont-blur=2.0
subalign=2
spualign=-1
spuaa=4
sub-fuzziness=1
flip=no
vf=pp=de,hqdn3d


My mplayer USE flags:
Code:
media-video/mplayer
     Available versions:  1.0_rc2_p28058-r1 (~)1.0_rc2_p28288 1.0_rc2_p28450 (~)1.0_rc2_p20090226 (~)1.0_rc2_p20090322 [M]**9999 {3dnow 3dnowext X a52 aac aalib alsa altivec amrnb amrwb arts ass bidi bindist bl cddb cdio cdparanoia cpudetection custom-cflags custom-cpuopts debug dga dirac directfb doc dts dv dvb dvd dvdnav dxr3 enca encode esd faac faad fbcon ftp ggi gif gtk iconv ipv6 jack joystick jpeg kernel_linux ladspa libcaca lirc live lzo mad md5sum mmx mmxext mng mp2 mp3 musepack nas nemesi network openal opengl oss png pnm pulseaudio pvr quicktime radio rar real realcodecs rtc samba schroedinger sdl speex sse sse2 ssse3 svga teletext tga theora tremor truetype unicode v4l v4l2 vdpau video_cards_mga video_cards_nvidia video_cards_s3virge video_cards_tdfx video_cards_vesa vidix vorbis win32codecs x264 xanim xinerama xscreensaver xv xvid xvmc zoran}
     Installed versions:  1.0_rc2_p20090322(01:42:00 PM 03/26/2009)(X a52 aac aalib alsa amrnb amrwb ass bidi bindist bl cddb cdio cdparanoia dga dirac directfb dts dv dvb dvd dvdnav enca encode esd faac faad fbcon ftp gif gtk iconv jack jpeg kernel_linux ladspa libcaca live lzo mad md5sum mmx mmxext mng mp2 mp3 musepack nemesi network openal opengl png pnm pvr quicktime rar real rtc samba schroedinger sdl speex sse sse2 ssse3 teletext tga theora tremor truetype unicode vdpau video_cards_nvidia vidix vorbis win32codecs x264 xanim xinerama xscreensaver xv xvid xvmc zoran -3dnow -3dnowext -altivec -arts -cpudetection -custom-cflags -custom-cpuopts -debug -doc -dxr3 -ggi -ipv6 -joystick -lirc -nas -oss -pulseaudio -radio -svga -v4l -v4l2 -video_cards_mga -video_cards_s3virge -video_cards_tdfx -video_cards_vesa)


I use this command to detect video information:
Code:
mplayer -dvd-device /dev/dvd -endpos 0 -ao null -vo null <filename>
Back to top
View user's profile Send private message
micmac
l33t
l33t


Joined: 28 Nov 2003
Posts: 996

PostPosted: Sun May 17, 2009 7:27 am    Post subject: Reply with quote

Code:
1.1.16:
  - fix quite a few return checks that caused avi2mp4.sh to not terminate
    properly
  - adjust ChangeLog's style :)
Back to top
View user's profile Send private message
lysergicacid
Guru
Guru


Joined: 25 Nov 2003
Posts: 352
Location: The Universe,Virgo Super Cluster,Milky Way,Earth

PostPosted: Thu Jan 07, 2010 11:09 pm    Post subject: Reply with quote

i know this is an old post but anyone having issues with this ?

Code:
Encoding audio:

Freeware Advanced Audio Coder
FAAC 1.28

Quantization quality: 90
Bandwidth: 14800 Hz
Object type: Low Complexity(MPEG-4) + M/S
Container format: MPEG-4 File Format (MP4)
Encoding /home/loz/2010_01_07_22_18_03_16132_mplay.wav to /home/loz/2010_01_07_22_18_03_16132_aac.m4a
   frame          | bitrate | elapsed/estim | play/CPU | ETA
333055/333055 (100%)|  121.3  |  393.9/393.9  |   18.04x | 0.0


Applying ReplayGain:

Error opening file: /home/loz/2010_01_07_22_18_03_16132_aac.m4a
/home/loz/2010_01_07_22_18_03_16132_aac.m4a is not a valid mp4/m4a file.


An error occured.

Command terminated with non-zero exit status.

_________________
[img]http://valid.canardpc.com/cache/banner/2040927.png[/img]
Desktop:
[img]http://valid.canardpc.com/cache/banner/2703952.png[/img]
Back to top
View user's profile Send private message
micmac
l33t
l33t


Joined: 28 Nov 2003
Posts: 996

PostPosted: Fri Jan 08, 2010 7:08 am    Post subject: Reply with quote

Hi there,

I had some issue with faac as well, I can't remember what it was exactly, though. But, you can use neroAacEnc (linux 32bit binary or through wine, see README) or you could choose not to use aacgain by commenting out some stuff in the script.

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


Joined: 28 Nov 2003
Posts: 996

PostPosted: Fri Jan 08, 2010 7:09 am    Post subject: Reply with quote

BTW :)

Code:

1.1.17:
  - Fixed a few spelling error
  - Changed initial configuration (point out a few differences between PSPs and
    iPods
1.1.18:
  - Fixed the if-block that deals with cropping and updating the aspect ratio
Back to top
View user's profile Send private message
lysergicacid
Guru
Guru


Joined: 25 Nov 2003
Posts: 352
Location: The Universe,Virgo Super Cluster,Milky Way,Earth

PostPosted: Fri Jan 08, 2010 3:29 pm    Post subject: Reply with quote

micmac wrote:
Hi there,

I had some issue with faac as well, I can't remember what it was exactly, though. But, you can use neroAacEnc (linux 32bit binary or through wine, see README) or you could choose not to use aacgain by commenting out some stuff in the script.

Regards!


i'm on 64 bit system and don't really want wine installed, i'll look through the script n disable aac i guess, thanks for the reply :)
_________________
[img]http://valid.canardpc.com/cache/banner/2040927.png[/img]
Desktop:
[img]http://valid.canardpc.com/cache/banner/2703952.png[/img]
Back to top
View user's profile Send private message
micmac
l33t
l33t


Joined: 28 Nov 2003
Posts: 996

PostPosted: Fri Jan 08, 2010 8:33 pm    Post subject: Reply with quote

Hi,

if you have a multilib 64 bit install the neroAacEnc Linux binary will work.

Regards
Back to top
View user's profile Send private message
sipingal
n00b
n00b


Joined: 12 May 2008
Posts: 62
Location: China

PostPosted: Sun Jan 10, 2010 1:45 pm    Post subject: I have another script here:) Reply with quote

It's for 768kbit/s 320×240 H.264 videos
Code:

    * BIT_RATE <= 768 kbps
    * 320×240
    * Up to 30 fps
    * H.264 Baseline Profile up to level 1.3


Following options must be set in the Baseline Profile

Code:

    * no B slices: bframes=0
    * no CAVLC entropy coding: nocabac
    * no 8×8 transform: no8x8dct
    * level=1.3: level_idc=13


More details please refer:
http://en.wikipedia.org/wiki/H.264 (Figer: Predefined profiles - BP column)
http://rob.opendot.cl/index.php/useful-stuff/h264-profiles-and-levels/
http://rob.opendot.cl/index.php/useful-stuff/ipod-video-guide/

If we have those information, we can have our owner ipod video encoding script.
My script attached. It supports encoding any video files or DVD to the ipod 5/5.5G format.
Usage:
$ ivconvert <video files> # if there is a subtitle file with the same as the video file in the current directory, it will embedding it in.
$ ivconvert dvd://


Code:
#!/bin/sh

DVDDEVICE="/dev/dvd"
#VC_FFH264="-vc ffh264"
VC_FFH264=""
MENCODER="mencoder"


setmediainfo()
{
    mediainfo="`mplayer -dvd-device ${DVDDEVICE} ${VC_FFH264} -endpos 0 -ao null -vo null "${file}" 2> /dev/null | grep --color=never -e "^VIDEO" -e "VO: \[null\]"`"
    INFOTYPE="`echo "$mediainfo" | wc -l`"
    if [ ${INFOTYPE} -eq 1 ]
    then
   mediainfo="`echo ${mediainfo} | awk '{print $3" "$5}'`"
    elif [ ${INFOTYPE} -eq 2 ]
    then
   sedcond="`echo "${mediainfo}" | grep --color=never "VO: \[null\]" | awk '{print "s/"$3"/"$5"/g"}'`"
   if [ ${usedvd} -eq 1 ]
   then
       mediainfo="`echo "${mediainfo}" | grep --color=never "^VIDEO" | awk '{print $3" "$6}'| sed -e "${sedcond}"`"
   else
       mediainfo="`echo "${mediainfo}" | grep --color=never "^VIDEO" | awk '{print $3" "$5}'| sed -e "${sedcond}"`"
   fi
    elif [ ${INFOTYPE} -eq 3 ]
    then
   sedcond="`echo "${mediainfo}" | grep --color=never "VO: \[null\]" | tail -n 1 | awk '{print "s/"$3"/"$5"/g"}'`"
   if [ ${usedvd} -eq 1 ]
   then
       mediainfo="`echo "${mediainfo}" | grep --color=never "^VIDEO" | awk '{print $3" "$6}'| sed -e "${sedcond}"`"
   else
       mediainfo="`echo "${mediainfo}" | grep --color=never "^VIDEO" | awk '{print $3" "$6}'| sed -e "${sedcond}"`"
   fi
    else
   echo "Mediainfo error, exit"
   exit 1
    fi
   
    mediainfo="`echo ${mediainfo} | sed s'/\.//'g | tr 'x' ' '`"
}


while [ "$1" != "" ]
do
    file="$1"
    usedvd=`echo ${file} | grep --color=never "dvd://" 2> /dev/null | wc -l`
    if [ ${usedvd} -eq 1 ]
    then
   outfile="dvdrip.m4v"
   setmediainfo
    else
   outfile="${file%.*}.m4v"
   subfile="${file%.*}.srt"
   setmediainfo
    fi
    shift
    media_width="`echo ${mediainfo} | awk '{print $1}'`"
    media_height="`echo ${mediainfo} | awk '{print $2}'`"
    media_fps="`echo ${mediainfo} | awk '{print $3}'`"
    if [ ${media_fps} -lt 10000 -o ${media_fps} -gt 31000 ]
    then
   media_fps=25000
    fi

    whc=`echo ${media_width}*100/${media_height} | bc`
    if [ ${whc} -lt 130 ]
    then
   width=`echo "(${media_width}*100*240/${media_height}/100+8)/16*16" | bc`
   height=240
    elif [ ${whc} -gt 136 ]
    then
   width=320
   height=`echo "(${media_height}*100*320/${media_width}/100+8)/16*16" | bc`
    else
   width=320
   height=240
    fi
   
    if [ -f "${subfile}" ]
    then
   $MENCODER -overlapsub -dvd-device ${DVDDEVICE} "${file}" ${VC_FFH264} -o "${outfile}" \
          -ofps ${media_fps}/1001 -af lavcresample=48000 -vf harddup \
          -oac lavc -lavcopts aglobal=1:acodec=libfaac \
          -ovc x264 \
          -x264encopts global_header:bitrate=200:mixed_refs:ratetol=50:subq=5:nocabac:no8x8dct:partitions=i4x4+p8x8+b8x8:me=umh:me_range=16:qcomp=0.6:frameref=5:bframes=0:trellis=1:level_idc=13 \
          -of lavf -lavfopts format=ipod \
          -vf scale=${width}:${height} \
          -alang eng -slang chi -unicode -subfont-encoding unicode -font "Consolas" -subfont "SimHei" -subfont-text-scale 3.8 -subcp cp936 -subpos 98 -sub "${subfile}"
    else
   $MENCODER -overlapsub -dvd-device ${DVDDEVICE} "${file}" ${VC_FFH264} -o "${outfile}" \
          -ofps ${media_fps}/1001 -af lavcresample=48000 -vf harddup \
          -oac lavc -lavcopts aglobal=1:acodec=libfaac \
          -ovc x264 \
          -x264encopts global_header:bitrate=200:mixed_refs:ratetol=50:subq=5:nocabac:no8x8dct:partitions=i4x4+p8x8+b8x8:me=umh:me_range=16:qcomp=0.6:frameref=5:bframes=0:trellis=1:level_idc=13 \
          -of lavf -lavfopts format=ipod \
          -vf scale=${width}:${height} \
          -alang eng -slang chi -unicode -subfont-encoding unicode -font "Consolas" -subfont "SimHei" -subfont-text-scale 3.8 -subcp cp936 -subpos 98
    fi
done


mplayer enabled faac for audio encoding and x264 for video encoding.

Code:

eix -e mplayer
[I] media-video/mplayer
     Available versions:  1.0_rc2_p20090322 1.0_rc2_p20090731 (~)1.0_rc4_p20091026 1.0_rc4_p20091026-r1 [M](~)1.0_rc4_p20091124-r1 [M]**9999 {3dnow 3dnowext +X +a52 +aac aalib +alsa altivec +ass bidi bindist bl bs2b +cddb +cdio cdparanoia (-)cpudetection (-)custom-cflags (-)custom-cpuopts debug dga +dirac directfb doc +dts +dv dvb +dvd +dvdnav dxr3 +enca +encode esd external-ffmpeg +faac +faad fbcon ftp ggi gif -gmplayer -gtk +iconv ipv6 jack joystick jpeg kernel_linux ladspa libcaca lirc +live lzo mad md5sum +mmx mmxext mng +mp2 +mp3 nas +nemesi +network nut openal opencore-amr +opengl +osdmenu oss png pnm pulseaudio pvr +quicktime radio +rar +real +rtc (-)samba +schroedinger sdl +shm +speex sse sse2 ssse3 svga teletext tga +theora +toolame +tremor +truetype +twolame +unicode v4l v4l2 vdpau video_cards_mga video_cards_nvidia video_cards_s3virge video_cards_tdfx video_cards_vesa vidix +vorbis (-)win32codecs +x264 xanim xinerama +xscreensaver +xv +xvid xvmc zoran}
     Installed versions:  1.0_rc4_p20091026-r1(09:53:23 PM 12/28/2009)(X a52 aac aalib alsa ass bidi bindist bl bs2b cddb cdio cdparanoia dga dirac directfb dts dv dvb dvd dvdnav enca encode esd faac faad fbcon ftp gif iconv jack jpeg kernel_linux ladspa libcaca live lzo mad md5sum mmx mmxext mng mp3 nas network nut openal opencore-amr opengl osdmenu png pnm pvr quicktime rar real rtc samba schroedinger sdl shm speex sse sse2 ssse3 teletext tga theora toolame tremor truetype twolame unicode vdpau video_cards_nvidia vidix vorbis win32codecs x264 xanim xinerama xscreensaver xv xvid xvmc zoran -3dnow -3dnowext -altivec -cpudetection -custom-cpuopts -debug -doc -dxr3 -ggi -gmplayer -ipv6 -joystick -lirc -oss -pulseaudio -radio -svga -v4l -v4l2 -video_cards_mga -video_cards_s3virge -video_cards_tdfx)
     Homepage:            http://www.mplayerhq.hu/
     Description:         Media Player for Linux


There are some excellent tools for you: "mp4info, mp4tags"
Code:

$ eix -e libmp4v2
[I] media-libs/libmp4v2
     Available versions:  1.9.1!t {utils}
     Installed versions:  1.9.1!t(10:55:01 PM 12/26/2009)(utils)
     Homepage:            http://code.google.com/p/mp4v2
     Description:         Functions for accessing ISO-IEC:14496-1:2001 MPEG-4 standard
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 Previous  1, 2, 3  Next
Page 2 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