| View previous topic :: View next topic |
| Author |
Message |
Sujao l33t


Joined: 25 Sep 2004 Posts: 665 Location: Germany
|
Posted: Sat Feb 12, 2005 1:49 pm Post subject: nrip - dvd to matroska converter |
|
|
| Quote: | Title: nrip
Version: 0.0.3
Last change: 21.02.2005
Purpose: Rip DVD, reencode video and audio tracks and multiplex into matroska container.
Author: removed for privacy reasons, see README file
Contact: removed for spam reasons, see README file
Download: http://nforum.de/forum/topic,726.html
License: GPL v2
########
FEATURES
########
nrip does in detail:
-Rip main title of dvd and reencode the video track with XVID codec in two pass mode, quality is made top priority. The xvid parameter can be changed by the user (interactive variables).
-Rip and reencode: ac3 5.1 --> user defined bitrate or keeping original, ac3 stereo --> ogg vorbis, mpeg1 --> left original to avoid further quality loss.
-Rip userdefined subtitle tracks.
-Multiplex everything into a matroska container.
nrip was designed for high quality rips thus target size shouldnt be less than. 2,18GB what is 1/2 of DVD-5. Since version 0.0.3 the target size is variable and can be specified by the user.
The encoding duration strongly depends whether you choose to use GMC(Global Motion Compensation) or not, the lenght of the movie and of course your CPU. I need about 26h for a 02h10m movie with GMC turned on and a 1000Mhz Athlon Thunderbird.
##############
REQUIEREMENTS
##############
The script needs the following programs to work:
- mplayer/mencoder
- lsdvd
- mkvmerge which is part of mkvtoolnix-1.0.1 (maybe also earlier versions but definetely later than 0.8.8. I upgraded directly to 1.0.1 and didn't test the packages inbetween. Gentoo users have to unmask the newest package. I did too and it works just fine.)
- oggenc which is part of libvorbis
- a arbitrary image viewer for viewing of crop preview. Default is "xv". You can change the path in the beginning of the script. Scroll down to the "interactive variables" section.
And optionally "dvdbackup" in order to be able to cache the DVD on harddrive.
More utils are required but they are all part of coreutils which are installed on 99.9% of all linux systems by default. There will be a check in the beginning so just start and you will see if something is missing.
Upgrade all packages to the newest version if possible. These are the packages I use so they should work for sure:
mplayer-1.0_pre5-r5
mkvtoolnix-1.0.1
lsdvd-0.10
dvdbackup-0.1.1-r1
libvorbis-1.0.1
If you are unsure whether your programms will work or not activate one-chapter-mode to perform a quick part conversion and test the resulting video for functions. If one-chpater-mode works than normal mode will work for 95%. One-chapter-mode is also activated at interactive variables in the script. Scroll down to this section. Its pretty obvious.
###########
LIMITATIONS
###########
-Can handle only single title DVDs, that means DVDs with ONE movie. Later versions will be able to handle several DVD titles per DVD disc. This is needed for DVDs with shows. At the moment only the main title is ripped.
-Can handle at most 10 audio/subtitle tracks.
-Can only handle ac3 and mpeg1 audio stremas, no dts/aac.
-Can't determine whether audio track is usual track or commentary. The tracks will apear identical. If that is so you have to find out yourself which one is the right ine. But in 98% of all cases the comentary is the last audiotrack.
-Only simple deinterlacing is possible. Inverse Telecine is not yet implemented. That means NTSC DVDs with 29,97 that were interlaced for DVDs will not be encoded very effectively. You probably wont see a difference but about 33% addition space will be wasted. I have not been able to figure out how the invert telecine filter works in mencoder and as I only have one NTSC DVD that was not made for theathers I have nothing to test with. So you would propably not want to use this script for NTSC DVDs as you wont get optimal results. And to be honest I dont know if I will investigate this issue at all... I mean, in the beginning I just wanted to write some lines of script to automate my ripping process. Some lines means 5-10! I didn't want to make a ~1300 line script. This thing here is much too complex for a bash script.
For more information about inverse telecine see here: http://www.divx-digest.com/articles/vhs_capture2.html
####
BUGS
####
-If temporary folder had been created and has to be deleted then deletes only last level of folder hirarchy. If /home/user was present and /home/user/movies/output/ was created as temporary folder than only "output" will be deleted afterwards and not "movies".
-At the time of this realease I wasnt able to track down the reason for a malfunction of xvid. It doesnt produce files with correct sizes. This bug might only appear when GMC is activated but I havent done enough testint to ensure this. If you produce final files with about 2.1GB please contact me and tell me whether you used GMC and which version of xvid and mplayer you use.
Please report further bugs as soon as discovered. Launch the script with the --debug option and send me the whole output with an description of what happended and what didn't work.
####
TIPS
####
- Pressing ENTER while entering a path makes nrip chose the default folder.
- You can edit some default values at the beginning of the script. Most important are default paths. Be careful with changing. Don't change a mount pount to a device ex. /home/user-->/dev/dvd and vice versa as this might break the script.
- There is a one-chapter-mode avaiable for quick testing. With this option activated only the first chapter of the first DVD title is converted. Depending on the DVD its duration is 10s to 5min. As all steps of the conversion are performed you can be pretty sure that if the one-chapter-mode conversion was successful the normal will be too.
#########
THANKS TO
#########
- The users of the Gentoo Forums for helping me with various problems. (forums.gentoo.org)
- "chris aka ctt" for lots of help with scripts.
- "booiiing" for testing.
Have fun!
#########
CHANGELOG
#########
0.0.3
- dvd cache is now really working
- dvd cache is now really left on harddrive if wanted
- overall target size is variable
- bitrate of ac3 5.1 streams is variable and can be left original
- ac3 stereo (2.0) is converted to ogg. new dependency "oggenc"
- added interactive variable "delete_temp_dir"
- added interactive variable "xvid_parameter". You can now change the parameters for the xvid codec if you want.
0.0.2a
- audio/subtitle listing uses longest track as it should (thanks to kKDu)
- changed volume normalisation to fit closer to original
- tuned target size to fit 1/2 DVD-5 more.
- no errors during listing anymore if no audio/subtitle tracks are in title
0.0.2
- implemented workaround for mencoder bug that displaces ac3 channels (thanks to brancaleone)
- mpeg2 audio is processed
- some minor bugs fixed
- some video encoding improvements
- preview also for manual crop mode
- some internal reorganisation
|
Be sure to download the latest package by all means.
Last edited by Sujao on Wed Apr 06, 2005 10:24 am; edited 6 times in total |
|
| Back to top |
|
 |
Sujao l33t


Joined: 25 Sep 2004 Posts: 665 Location: Germany
|
Posted: Tue Feb 15, 2005 9:34 am Post subject: |
|
|
New version avaiable! Dont use the old one anymore....By the way, some feedback would be nice? I at least I would like to know WHY you dont want want to use this script.  |
|
| Back to top |
|
 |
kKDu Apprentice


Joined: 18 Aug 2003 Posts: 187
|
Posted: Wed Feb 16, 2005 3:25 pm Post subject: |
|
|
Sorry but for me, the script doesn't work!
I have this errors:
| Code: | The following audio tracks are present. Enter the number(s) of the track(s) I shall rip seperated by spaces. Example: "0 1". If you see identical tracks then enter the first occurance of it. This is usually the right one......usually ;) If you don't want any audio then just press [RETURN].
seq: Please specify step of -1 since this behaviour is obsolete and will be removed in the future
/home/hagen/.bin/nrip.sh: line 610: a_track_format: bad array subscript
/home/hagen/.bin/nrip.sh: line 610: a_track_format: bad array subscript
:0
The following subtitle tracks are present. Enter the number(s) of the track(s) I shall rip seperated by spaces. Example: "0 1". If you see identical tracks then enter the first occurance of it. This is usually the right one......usually ;) If you don't want any audio then just press [RETURN].
seq: Please specify step of -1 since this behaviour is obsolete and will be removed in the future
0. Language:
/home/hagen/.bin/nrip.sh: line 628: s_track_lang_code: bad array subscript
-1. Language:
:0 1
.
.
.
16:10:52 (16.Feb) reencoding audio track ...DONE!
16:10:52 (16.Feb) dumping subtitle track ...DONE!
16:10:52 (16.Feb) dumping subtitle track ...DONE!
/home/hagen/.bin/nrip.sh: line 1307: /tmp/nrip/subtitles.idx: No such file or directory
mv: Aufruf von stat für ,,/tmp/nrip/subtitles.sub" nicht möglich: Datei oder Verzeichnis nicht gefunden
du: Zugriff auf ,,/tmp/nrip/audio_*.avi" nicht möglich: Datei oder Verzeichnis nicht gefunden
du: Zugriff auf ,,/tmp/nrip/subtitles_clean.sub" nicht möglich: Datei oder Verzeichnis nicht gefunden
expr: Argumente, die keine Zahlen sind
16:10:52 (16.Feb) encoding video in first pass...DONE!
16:10:52 (16.Feb) encoding video in second pass...DONE!
16:10:52 (16.Feb) merging into matroska container...DONE!
16:10:52 (16.Feb) emptying temporary folder "/tmp/nrip"...f_debug rm -fR /tmp/nrip/*
DONE!
*******************************************************************************
16:10:52 (16.Feb) EVERYTHING IS DONE!
The output file is at "/home/hagen/mp3/Schultze.mkv"
ls: /home/hagen/mp3/Schultze.mkv: Datei oder Verzeichnis nicht gefunden
The file has a size of .
This script ran 3 minutes.
ENJOY!
*******************************************************************************
|
I don't have the time to check it myself at the moment, but I think the error occurred, because $tracks_info
has bad values:
[open] number of audio channels on disk: 0. [open] number of subtitles on disk: 0.
The DVD I use was "Schultze gets the blues" and I set the script to chapter mode.
I was very interested in your script, because I've been writing my own since three weeks.
But my point is to rip to a 700MB matroska file.
Your crop detection gives also bad default values. I have automating my cropdetection with mplayer and it always finds good values (tested at 6 DVDs).
This is just my first impression.
I will give you more response next week. _________________ http://www.vim.org |
|
| Back to top |
|
 |
beandog Developer


Joined: 04 May 2003 Posts: 1948 Location: /usa/utah
|
Posted: Wed Feb 16, 2005 4:52 pm Post subject: |
|
|
| Sujao wrote: | New version avaiable! Dont use the old one anymore....By the way, some feedback would be nice? I at least I would like to know WHY you dont want want to use this script.  |
Very cool Sujao .. gonna try this as soon as I get home.
For the extremely lazy in all of us, here's a link to the forum (I actually had to read to find it!) to download the script: http://nforum.de/forum/topic,726.html _________________ If it ain't broke, tweak it. packages | planet | blog | home |
|
| Back to top |
|
 |
Sujao l33t


Joined: 25 Sep 2004 Posts: 665 Location: Germany
|
Posted: Wed Feb 16, 2005 7:02 pm Post subject: |
|
|
Oh sorry, I forgot to put in the URL tag after the update.
EDIT: At the moment there is a problem with the target rate. xvid-1.0.2 doesnt produce files with the specified target size. A file I specified as ~1,7GB became ~2,8GB. I am investigating this issue at the moment. |
|
| Back to top |
|
 |
kKDu Apprentice


Joined: 18 Aug 2003 Posts: 187
|
Posted: Thu Feb 17, 2005 1:46 pm Post subject: |
|
|
By the way, xvid 1.1.0_beta is avaiable and significant faster.
| Code: | inherit eutils
MY_P=${PN}core-${PV/_beta/-beta}
DESCRIPTION="XviD, a high performance/quality MPEG-4 video de-/encoding solution."
HOMEPAGE="http://www.xvid.org/"
SRC_URI="http://files.xvid.org/downloads/${MY_P}.tar.bz2"
LICENSE="GPL-2"
SLOT="1"
KEYWORDS="~x86 ~amd64 ~sparc"
IUSE="doc"
DEPEND="virtual/libc
x86? ( >=dev-lang/nasm-0.98.36 )"
S="${WORKDIR}/${MY_P}/build/generic"
src_unpack() {
unpack ${A}
cd ${S}
}
src_install() {
make install DESTDIR=${D} || die
cd ${S}/../../
dodoc AUTHORS ChangeLog README TODO doc/*
local mylib="$(basename $(ls ${D}/usr/$(get_libdir)/libxvidcore.so*))"
dosym ${mylib} /usr/$(get_libdir)/libxvidcore.so
dosym ${mylib} /usr/$(get_libdir)/${mylib/.1}
if use doc ; then
dodoc CodingStyle doc/README
insinto /usr/share/doc/${PF}/examples
doins examples/*
fi
}
|
_________________ http://www.vim.org |
|
| Back to top |
|
 |
Sujao l33t


Joined: 25 Sep 2004 Posts: 665 Location: Germany
|
Posted: Thu Feb 17, 2005 4:50 pm Post subject: |
|
|
@kKDu: Did you edit your first post? I saw you comment just two minutes ago.
Thanks for the feedback, could you please post the complete output of
| Code: | | mplayer dvd://1 -dvd-device /path/to/dvd -frames 0 -v 2 |
And please also tell me the version of mplayer your are using. Oh and you probably wont want to use nrip for 700MB rips as it keeps the ac3 5.1 audio tracks and they usually take about 230MB per language so that you dont have too much space for the video stream left. |
|
| Back to top |
|
 |
kKDu Apprentice


Joined: 18 Aug 2003 Posts: 187
|
Posted: Fri Feb 18, 2005 12:32 pm Post subject: |
|
|
I use MPlayer 1.0pre6-3.3.5 (mplayer-1.0_pre6.ebuild).
The problem is, that track 1 is not my film-track, it is a track with no audio nor subtitles, I thing you should get track_info like this:
| Code: | | tracks_info=`mplayer -v 2 dvd://${longest_track} -dvd-device $dvd_path -nosound -frames 0 2> /dev/null | grep '\[open\]'` |
By the way replace -v 2 with -v.
I also saw your post on xvid-users. That's very interesting, because I have the same problem from the other side.
My videos are mostly to small, for example bitrate=-645000 gives me a video with 620MB.
My output of mplayer dvd://1 -dvd-device /mnt/cdrom -frames 0 -v 2
| Code: | MPlayer 1.0pre6-3.3.5 (C) 2000-2004 MPlayer Team
CPU: Advanced Micro Devices Athlon 64 Clawhammer (Family: 8, Stepping: 8)
Detected cache-line size is 64 bytes
CPUflags: MMX: 1 MMX2: 1 3DNow: 1 3DNow2: 1 SSE: 1 SSE2: 1
Kompiliert für x86 CPU mit folgenden Erweiterungen: MMX MMX2 3DNow 3DNowEx SSE SSE2
Warning unknown option cache_min at line 144
Warning unknown option cache_prefill at line 147
77 Audio- & 188 Videocodecs
Kommandozeile: 'dvd://1' '-dvd-device' '/mnt/cdrom' '-frames' '0' '-v' '2'
init_freetype
get_path('font/font.desc') -> '/home/hagen/.mplayer/font/font.desc'
font: can't open file: /home/hagen/.mplayer/font/font.desc
Font /usr/share/mplayer/font/font.desc loaded successfully! (206 chars)
Using MMX (with tiny bit MMX2) Optimized OnScreenDisplay
Using nanosleep() timing
get_path('input.conf') -> '/home/hagen/.mplayer/input.conf'
Can't open input config file /home/hagen/.mplayer/input.conf: Datei oder Verzeichnis nicht gefunden
Parsing input config file /usr/share/mplayer/input.conf
Input config file /usr/share/mplayer/input.conf parsed: 59 binds
get_path('1.conf') -> '/home/hagen/.mplayer/1.conf'
Spiele dvd://1
libdvdread: Attempting to use device /dev/ide/host0/bus1/target0/lun0/cd mounted on /mnt/cdrom for CSS authentication
get_path('DVDKeys') -> '/home/hagen/.mplayer/DVDKeys'
Lese Disk-Struktur, bitte warten...
Es sind 6 Titel auf dieser DVD.
Es sind 1 Kapitel in diesem DVD-Titel.
Es sind 1 Kameraeinstellungen diesem DVD-Titel.
DVD erfolgreich geöffnet.
[open] number of audio channels on disk: 0.
[open] number of subtitles on disk: 0
DVD start cell: 0 pack: 0x0-0x4
DVD start=0 end=4
No matching DVD audio language found!
CACHE_PRE_INIT: 0 [0] 0 pre:0 eof:0
Cache fill: 0,00% (0 bytes) --- END OF CELL !!! ---
dvd_next_cell: next1=0x0
dvd_next_cell: next2=0x0
Cache fill: 0,10% (8192 bytes) Checking for YUV4MPEG2
ASF_check: not ASF guid!
Checking for Nullsoft Streaming Video
Checking for NuppelVideo
Checking for REAL
Checking for SMJPEG
Searching demuxer type for filename dvd://1 ext: (null)
Checking for MOV
Checking for VIVO
header block 1 size: 0
Checking for PVA
Checking for MPEG-TS...
THIS DOESN'T LOOK LIKE AN MPEG-TS FILE!
TRIED UP TO POSITION 0, FOUND ffffff00, packet_size= 0, SEEMS A TS? 0
Checking for LMLM4 Stream Format
Invalid packet in LMLM4 stream: ch=0 size=1140851708
LMLM4 Stream Format not found
system stream synced at 0xD (0)!
==> Videostream gefunden: 0
MPEG-PS-Dateiformat erkannt!
MPEG Stream reached EOF
ds_fill_buffer: EOF reached (stream: audio)
MPEG: Kein Audiostream gefunden. -> kein Ton.
Searching for sequence header... OK!
VIDEO: MPEG2 720x576 (aspect 2) 25,000 fps 8000,0 kbps (1000,0 kbyte/s)
[V] filefmt:2 fourcc:0x10000002 size:720x576 fps:25,00 ftime:=0,0400
get_path('sub/') -> '/home/hagen/.mplayer/sub/'
get_path('default.sub') -> '/home/hagen/.mplayer/default.sub'
X11 opening display: :0.0
vo: X11 color mask: FFFFFF (R:FF0000 G:FF00 B:FF)
vo: X11 running at 1024x768 with depth 24 and 32 bpp (":0.0" => local display)
[x11] Detected wm supports layers.
[x11] Detected wm supports NetWM.
[x11] Detected wm supports ABOVE state.
[x11] Detected wm supports BELOW state.
[x11] Detected wm supports FULLSCREEN state.
[x11] Detected wm supports STAYS_ON_TOP state.
[x11] Current fstype setting honours LAYER FULLSCREEN STAYS_ON_TOP ABOVE BELOW X atoms
==========================================================================
Öffne Videodecoder: [mpegpes] MPEG 1/2 Video passthrough
VDec: VO wird versucht, auf 720 x 576 (Bevorzugter Farbraum: Mpeg PES) zu setzen.
Trying filter chain: vo
Konnte keinen passenden Farbraum finden - neuer Versuch mit '-vf scale'..
Öffne Videofilter: [scale]
SwScale params: -1 x -1 (-1=no scaling)
Trying filter chain: scale vo
Der ausgewählte Videoausgabetreiber ist nicht kompatibel mit diesem Codec.
Initialisierung des Videodecoders fehlgeschlagen :(
Öffne Videodecoder: [libmpeg2] MPEG 1/2 Video decoder libmpeg2-v0.4.0b
Selected video codec: [mpeg12] vfm:libmpeg2 (MPEG 1 or 2 (libmpeg2))
==========================================================================
Audio: kein Ton!
Freeing 0 unused audio chunks.
Starte Wiedergabe...
Deinitialisiere Video: libmpeg2
get_path('2.conf') -> '/home/hagen/.mplayer/2.conf'
Spiele 2
Datei nicht gefunden: '2'
Failed to open 2
vo: uninit ...
Beenden... (Dateiende erreicht.)
|
_________________ http://www.vim.org |
|
| Back to top |
|
 |
kKDu Apprentice


Joined: 18 Aug 2003 Posts: 187
|
Posted: Fri Feb 18, 2005 2:07 pm Post subject: |
|
|
Also I noticed that | Code: | | mplayer -af volume=$some_value | produced bad sound for me.
I encode to ogg:
| Code: |
oggenc -q 2 ${TMP_DIR}/soundpipe -o ${TMP_DIR}/audio.ogg \
1>/dev/null & p_mplayer -aid $audiotrack \
-really-quiet -ao pcm -aofile ${TMP_DIR}/soundpipe -vo null \
-vc dummy -af volume=18 1>/dev/null 2>/dev/null
|
I think we should use another way to increase sound. _________________ http://www.vim.org |
|
| Back to top |
|
 |
brancaleone n00b


Joined: 21 Jun 2004 Posts: 27 Location: Buenos Aires, Argentina
|
Posted: Mon Feb 21, 2005 6:37 pm Post subject: |
|
|
| Quote: | Also I noticed that
mplayer -af volume=$some_value
produced bad sound for me. |
During my experiments with 5.1 ac3 I've observed that the volume filter increased volume unevenly. After amplification, some parts of the movie played one or two dB bellow the original level (which I considered acceptable), but in a few occasions oher parts went one dB over the maximum level. Other than that, the overall sound quality is good for me.
You also might want to add -nowaveheader to the mplayer part of your ogg encoding. More information in these posts: http://forums.gentoo.org/viewtopic-t-282985.html
http://forums.gentoo.org/viewtopic-t-190949.html _________________ Algunos son humildes porque no les han dado la oportunidad... |
|
| Back to top |
|
 |
Sujao l33t


Joined: 25 Sep 2004 Posts: 665 Location: Germany
|
Posted: Tue Feb 22, 2005 1:33 am Post subject: |
|
|
| New bugfixing version! |
|
| Back to top |
|
 |
Sujao l33t


Joined: 25 Sep 2004 Posts: 665 Location: Germany
|
Posted: Wed Apr 06, 2005 10:19 am Post subject: |
|
|
| New Version available. See changelog for changes. |
|
| Back to top |
|
 |
Pkunkage n00b

Joined: 10 Sep 2004 Posts: 4
|
Posted: Mon Apr 11, 2005 11:38 pm Post subject: you should try to includ transcode support |
|
|
| while mencoder is a nice encoder for general conversion , you should try to include support for transcode which offers lots of advanced options and full support for the latest xvid codec API's. I've done a lot of encoding using transcode , and from the results it seems to beat all other encoders i have come accross in quality and sheer choice/tweaking of audio/video codecs. |
|
| Back to top |
|
 |
Sujao l33t


Joined: 25 Sep 2004 Posts: 665 Location: Germany
|
Posted: Wed Apr 13, 2005 4:00 pm Post subject: |
|
|
| Hmm, would you like to participate and give me the right parameters? At the moment I dont have the time to deal with transcode as my semester started again. |
|
| Back to top |
|
 |
assente Guru


Joined: 12 Apr 2004 Posts: 570 Location: Torino, italia, New Europe
|
Posted: Wed Jul 27, 2005 10:30 am Post subject: |
|
|
after some crop tests I got this:
| Code: |
...
pression (error token is ": 501.2 237/237 33% 76% 0.0% 0 0 1% crop area: X: 84..294 Y: 212..289 (-vf crop=208:64:86:220)")
./nrip.sh: line 912: let: sum_x = 3520 + V: 501.3 238/238 33% 76% 0.0% 0 0 1% crop area: X: 84..294 Y: 212..289 (-vf crop=208:64:86:220): syntax error in expression (error token is ": 501.3 238/238 33% 76% 0.0% 0 0 1% crop area: X: 84..294 Y: 212..289 (-vf crop=208:64:86:220)")
./nrip.sh: line 913: let: sum_y = 2800 + V: 501.3 238/238 33% 76% 0.0% 0 0 1% crop area: X: 84..294 Y: 212..289 (-vf crop=208:64:86:220): syntax error in expression (error token is ": 501.3 238/238 33% 76% 0.0% 0 0 1% crop area: X: 84..294 Y: 212..289 (-vf crop=208:64:86:220)")
./nrip.sh: line 912: let: sum_x = 3520 + V: 501.3 239/239 33% 76% 0.0% 0 0 0% crop area: X: 84..294 Y: 212..289 (-vf crop=208:64:86:220): syntax error in expression (error token is ": 501.3 239/239 33% 76% 0.0% 0 0 0% crop area: X: 84..294 Y: 212..289 (-vf crop=208:64:86:220)")
...
|
_________________ Blog
E8400, 4850, P5q |
|
| Back to top |
|
 |
assente Guru


Joined: 12 Apr 2004 Posts: 570 Location: Torino, italia, New Europe
|
|
| Back to top |
|
 |
|