Archiving Recordings to DVD

From MythTV Official Wiki
Revision as of 13:52, 8 March 2006 by 209.123.8.145

Jump to: navigation, search

Archiving Stuff to DVD

You can do a couple of things here; either simply write off the videos as data or author a 'proper' DVD that plays in real DVD players.

There's a page of /External Links

This page describes the second approach and uses the following basic steps:

  1. Find the file you want.
  2. Run avidemux2 and break the file into video and audio portions.
  3. Run mplex to reassemble it in DVD compatible format.
  4. Run dvdauthor to create a DVD compatible file structure.
  5. Run growisofs to actually make the DVD.

Find the File

The files are saved with a long numeric file name that has to do with the start and stop times of the recording and are not at all intuitive. There are scripts to make links to the files with human readable file names - one such is mythname.pl in the contrib directory.


Burning .nuv Files to DVD

This is specific to MPEG2 .nuv files created by [[HardWare/Video Capture Cards|Hauppauge PVR-X50]] video capture cards.

The software packages you will want are:

  • dvd rw-tools
  • dvdauthor
  • mjpegtools
  • avidemux2
  • transcode - not necessary for this, but useful for working with video
  • k3b - a gui for burning DVD's and CD's. Not necessary, but useful.

The 'recipe':

1. Find the file you want.
2. Run avidemux2 and open the .nuv file that is the program you want to burn to DVD.
3. You will now cut out the segments you want. Find the beginning of the segment to cut.
Click the "Previous keyframe" button (<<) to make sure your cut is on keyframe.
Click twice on "A" when you are at the beginning of the segment you want to save.
Then find the end of the segment, click "Next keyframe" (>>) and click "B".
Note: If you do not cut on keyframes, you may have audio sync problems. 4. Then save the raw video stream and audio.
Set "Outp.fmt" to "Mpeg video".
Then go to File-> Save -> Save Raw Video Stream.
Save the file as "1.m2v".
When that's done, go to Audio -> Save Audio.
Save the file as "1.mp2". 5. Repeat steps 2, 3, and 4 until you have all segments you want saved.
6. Mplex the video and audio for each segment together in DVD-MPEG2 format. Do that by running
      mplex -f 8 -o 1.mpg 1.m2v 1.mp2 
7. Create a DVD file system by running
      dvdauthor -o DVD 1.mpg 2.mpg ... 
      dvdauthor -T -o DVD 
8. Put a blank DVD in your drive and write the video by running
      growisofs -Z /dev/scd0 -dvd-video DVD 
or you can create an image if you want to make multiple copies:
      mkisofs -dvd-video -o dvd.img DVD
9.  Be sure and check the DVD in a player and then delete all the files you created in this process.

Notes:

You can reduce the size of your files and fit more video on a DVD by using tcrequant, which is part of transcode. Do this as shown
      tcrequant -i 1.m2v -o 1-rq.m2v -f 1.5
The 1.5 is the reduction factor. You can adjust this to be any value between 1 and 2. 1 would keep the file the same size (wouldn�t make any sense to do so), and as far as I understand it, 2 would reduce the video file size by half. For DVD5 you can calculate the requantize factor with this formula:
      requant_factor = (video_size / (4700000000 - audio_size)) * 1.04
Where audio_size is the size of all audio and subtitle streams in bits.

NOTE: The constant above (4700000000) assumes single-layer DVD media. If using dual-layer DVD media, double the number.

The steps above create a DVD that starts playing the video automatically. If you want to burn a DVD with menus and multiple video titles, see the DVDs With Menus How-To.

Burning HDTV .nuv Files to DVD

  • avidemux 2.0.42 is known to work. (Earlier versions may not.)
  • List of other dependencies here.

The following 'recipe' has been used to archive 720p HDTV .nuv files to DVD:

1. Find the file you want.
2. Run avidemux2 and open the .nuv file that is the program you want to burn to DVD.
3. Find the beginning of the segment to cut. Click the "Previous keyframe" button (<<) to make sure your cut is on a keyframe. Click twice on "A" when you are at the beginning of the segment you want to save.  Then find the end of the segment, click "Next keyframe" (>>) and click "B".
4. Select "DVD" for the video type and "FFm AC3" for the audio type.
5. Set "Outp.fmt" to "Mpeg A V (PS)".
6. Click "V Filter" to add video filters to create an output stream that is appropriate for DVD as follows.
7. The first filter should be to "Resample FPS" to 29.97.  (I said no to "Use linear blend?")
8. The second filter should be to "Crop" enough lines off the top to remove the VBI data.  (4 lines works for me.)
9. The third and final filter should be "Mplayer Resize" to 720x480.
10. Select "V Process" so the video actually gets processed.
11. Select "A Filter" to add an audio filter in order to sync the audio and video streams.
12. Select "Timeshift" and add the necessary shift in milliseconds.  (This should be the amount displayed when the file was indexed as you loaded it into avidemux.)
13. Select "A Process" so the audio actually gets processed.
14. Save the file to 1.mpg.
15. Create a DVD file system by running
      dvdauthor -o DVD 1.mpg
      dvdauthor -T -o DVD 
16. Put a blank DVD in your drive and write the video by running
      growisofs -Z /dev/scd0 -dvd-video DVD
17. Be sure and check the DVD in a player and then delete all the files you created in this process.

Note: This has been tested on 720p (1280x720) capture of PBS programming where no commercials need to be removed and thus the show only needs to be trimmed at the ends.

Archive to VCD

Cory said:

I've been relatively frustrated with the experience, myself... but I did manage to make one SVCD go using the following steps:

- strip the audio

'mpeg2desc -a0 < infile.nuv > temp.mp2'

- strip the video

'mpeg2desc -v0 < infile.nuv > temp.m2v'

- resize the video (by 1.5x e.g.)

'tcrequant -i temp.m2v -o temp_crunched.m2v -f 1.5'

- resample audio for 44.1kHz SVCD-compliant mp2

'mpg123 -s temp.mp2 | sox -c 2 -s -r 48000 -w -t raw - -r 44100 -t wav - | \ mp2enc -b 192 -r 44100 -o temp44.mp2'

- recombine into SVCD-friendly stream

'tcmplex -N -m s -p temp44.mp2 -i temp_crunched.m2v -o temp.mpg'

- Cut out commercials with GOPchop

'gopchop'... plus gui-isms -> temp_cut.mpg

- master SVCD image

'vcdimager -t svcd temp_cut.mpg'

- burn image

'cdrdao write --device 0,6,0 videocd.cue'

Boy... I forgot what a royal PITA this was! It did, however, result in a 695MB standards-compliant SVCD with 43 minutes of video with SP-VHS quality.

Doing the GOPchop after the requantization was necessary, as it currently appears to break the audio streams so stream strippers don't recognize them.

Haven't gone down the DVD road yet. Right now I'm thinking of trying to modify the procedure to make a 'mini-DVD' (e.g. DVD format on a CD), using 1/2 D1 size of 352x480. That should be easily scalable to full-sized DVD's, and probably just about as compatible with set-top DVD players. So far my experience with SVCD compatibility has been underwhelming.


stan submitted this script:
#!/bin/sh

##################################################################
#
# wrie_dvd
#
# Writes a DVD from a MythTV saved .nuv file (assumeing it was saved
# with a PVR-250 or OVR-350, thus it's already in MPEG2 format)
#
# Argument 1 is the name of the .nuv file
#
################################################################

WORKDIR=work$$

cd /cache/tmp

mkfifo aud0
mkfifo vid0
mkfifo dvdmpg

# If getting mplex errors with DVB recs, try adding -s to mpeg2desc
mpeg2desc -a0 < $1 > aud0