OUTDATED, not covering the development Versions!!!

Contents:

0. Preface
1. Analysing the .vdr file(s)
2. Demux and sync the audio and video streams
3. Check the output (optional)
4. Create a new, DVD compatible file (optional)
3. Check the output (optional)
5. Doing all in one step

6. Create a DVD from the result



0. Preface
This is an updated version of the Manual for 
vdrsync 0.1.2.0. 
Vdrsync is a Perl Script that demultiplexes VDR 
recordings and tries to synchronize the Video and 
Audio Streams by addition or deletion of Audio Data. 
It can also start some other tools at the end of 
a run to generate a Video-DVD Directory structure, 
that can be burned on a DVD

You might also want to have a look at the INSTALL 
file that came with this tool. Or at the vdrsync
script itself. 



1. Analysing the .vdr file(s)

Type:

vdrsync -i /path/to/recording/

You should get some info like 

<SNIP>


audio stream bd info (AC3 audio):
Sample frequency:    48000
Bitrate:             448000
Mode:                2/0
Frame length (bytes) 1792
Frame length (ticks) 2880 (90000 / sec)



audio stream c0 info (MPEG1_Layer_2):
Sample frequency:    48000
Bitrate:             192000
Mode:                stereo
Copyright:           1
Frame length (bytes) 576
Frame length (ticks) 2160 (90000 / sec)


video stream e0 info:
Frame length (ticks) 3600 (90000 / sec)


</SNIP>

This means that the script found a total of three 
streams in your recording, one video and two audio 
streams.
Most often the video stream has the id e0, the first
audio stream the id c0 and an AC3 audio stream has
the id bd.

If you the script can not find at least two streams 
in your file, then you found a bug in the script or 
your recording is broken....


2. Demux and sync the audio and video streams

Next type
vdrsync /path/to/recording

You should see the same messages as before, but in 
addition there should be something like

 10 Mbytes read
 20 Mbytes read
 30 Mbytes read
 ......
on your screen. Once in a while the script might tell you 
that it detected a cut. That is ok.


When the script finished (it takes 4:24 min for 2000 MB
on my machine), you should find some new files in the 
current directory.
They have names like e0.mpv or bd.ac3. These files contain
the separated video and audio streams of your recording.


3. Check the output (optional)
Now, if you have transcode installed, type

tcprobe -i e0.mpv

(substitute the filename with the filenames you got;
if you do not have transcode installed, just skip ahead)



You should get something like 

tcprobe -i e0.mpv
[tcprobe] MPEG elementary stream (ES)
[tcprobe] summary for e0.mpv, (*) = not default, 0 = not detected
import frame size: -g 704x576 [720x576] (*)
     aspect ratio: 16:9 (*)
       frame rate: -f 25.000 [25.000] frc=3
   no audio track: use "null" import module for audio
   

and

tcprobe -i c0.mpa
[tcprobe] MP2 stream
[tcprobe] summary for c0.mpa, (*) = not default, 0 = not detected
      audio track: -a 0 [0] -e 48000,16,2 [48000,16,2] -n 0x50 [0x2000] (*)
                   bitrate=192 kbps
  
and maybe 

tcprobe -i bd.ac3
[tcprobe] AC3 stream
[tcprobe] summary for bd.ac3, (*) = not default, 0 = not detected
      audio track: -a 0 [0] -e 48000,16,2 [48000,16,2] -n 0x2000 [0x2000]
                   bitrate=448 kbps


Next thing you might want to test is the video itself.
If you have mplayer or xine installed type

mplayer e0.mpv

or

xine e0.mpv

You should see the film without hearing any sound.


4. Create a new, DVD compatible file (optional)

Now you might want to create a new file with audio and video
that can be used for SVCD or DVD production.

For DVD type

tcmplex -i e0.mpv -p c0.mpa -s bd.ac3 -m d -o new_file.mpg

where

-i e0.mpv 
is for the main video, it might be called e4.mpv
on your system, important is that it ends with .mpv

-p c0.mpa 
is the first audio stream, just take a file that ends with 
.mpa or .ac3

-s bd.ac3 
is for the optional second audio stream. Again, just take 
a file that ends with .mpa or .ac3

-m d
is for a DVD compatible stream. If you want a SVCD, take
-m s

-o new_file.mpg 
tells tcmplex to store the result under the name 
new_file.mpg

Now its really time to check the resulting movie for
audio/video sync.
Try 

mplayer new_file.mpg

or 

xine new_file.mpg


Do the lips of the actors move at the 
right time? Can you hear the crash of a car when you see
it, or do you hear it a bit too early or too late?
If audio or video is not in sync, you tried everything 
for nothing. Sorry. And I wrote this tool for nothing.
Drop me a mail and I see whether I can fix it.

Now, you found this a bit too much to type until now?

5. Doing all in one step (optional)

Try

vdrsync /path/to/recording -m

-m
tells the script to do the tcmplex step automatically.

If you get the nice e0mpv_c0mpa_bdac3_remux.mpg file,
you can / should check it like I told you above:

xine e0mpv_c0mpa_bdac3_remux.mpg
NOTE: the run took 14 min including remuxing on my 
2.4 GHz PIV

6. Create a DVD from the result

If you like the results, you might want to create a DVD.
I do this with dvdauthor, here is how:

NOTE: You can do all of this automatically by specifying 
the -master-dvd option on the command line.


dvddirgen -o ./DVD

-o ./DVD
tells the program where to store the files for the DVD.
In fact, in recent versions of dvdauthor it does not create
anything. It just deletes files from previous runs of dvdauthor.

Next type

dvdauthor -o ./DVD new_file.mpg

or 

dvdauthor -o ./DVD e0mpv_bdac3_c0mpa_remux.mpg
INFO: dvdauthor creating VTS
STAT: Picking VTS 01

STAT: Processing e0mpv_bdac3_c0mpa_remux.mpg...
STAT: VOBU 4 at 0MB, 1 PGCS, 0:00:02
INFO: Generating VTS with the following video attributes:
INFO: TV standard: pal
INFO: Aspect ratio: 16:9
INFO: Resolution: 704x576
INFO: Audio ch 0 format: ac3/6ch, drc
INFO: Audio ch 1 format: mp2/2ch, 20bps

STAT: fixed 4 VOBUS

This creates the folder structure for a DVD, and stores
the movie in it. You still need some additional files
so type

dvdauthor -T -o ./DVD

INFO: dvdauthor creating table of contents
scanning ./DVD/VIDEO_TS/VTS_01_0.IFO

Now you have a valid DVD structure in the directory ./DVD

type ls -lR and it should look like this:

ls -lR
.:
total 0
drwxr-xr-x    2 nobody  users          48 2003-05-22 17:11 AUDIO_TS
drwxr-xr-x    2 nobody  users         208 2003-05-22 17:13 VIDEO_TS

./AUDIO_TS:
total 0

./VIDEO_TS:
total 1013
-rw-r--r--    1 nobody  users        6144 2003-05-22 17:13 VIDEO_TS.BUP
-rw-r--r--    1 nobody  users        6144 2003-05-22 17:13 VIDEO_TS.IFO
-rw-r--r--    1 nobody  users       12288 2003-05-22 17:11 VTS_01_0.BUP
-rw-r--r--    1 nobody  users       12288 2003-05-22 17:11 VTS_01_0.IFO
-rw-r--r--    1 nobody  users      993280 2003-05-22 17:11 VTS_01_1.VOB

Probably you took more than 2 seconds of video, so there will
bigger files and maybe more files than in this example.

NOTE: the directory structure for a dvd is now 
automatically created by adding the -master-dvd option 
to the commandline.

Now you have to create an image that you can burn, but you 
need an image first.

mkisofs -dvd-video -o ./DVD_image.img  ./DVD 

Total translation table size: 0
Total rockridge attributes bytes: 0
Total directory bytes: 4096
Path table size(bytes): 42
Max brk space used 47e4
800 extents written (1 Mb)

Again, you will probably have more data than I have for this 
example.

Finally you can burn a DVD-R / DVD-RW with

dvdrecord  dev=0,0,0 -v -dao  ./DVD_image.img
(Works on SuSE Linux 8.1 and 8.2)
You have to adjust dev=0,0,0 for your
DVD-Recorder (I have 1,0,0).
For the command line people:
You can also save disk-space by creating the image 
and writing on the fly. I do it with

mkisofs -dvd-video  ./DVD | dvdrecord tsize=$(echo "`mkisofs -dvd-video --print-size ./DVD 2>/dev/null`*2048" | bc -l ) dev=0,0,0 -v -dao -

all on one line.

If all is fine, enjoy! 
And if you find some time, let me know that it works!


19-09-2003

Peter

(vdrsync at vdr-portal.de)

