« How to Setup Ubuntu for Reinstalling your applications without losing your data | Main | Bash Script Shortcuts »
Friday
06Mar2009

Convert TS files to DVD in Linux

  I have a dreambox satellite receiver and it records to a transport stream (TS) mpeg2 form. Since dvd's are also in mpeg2 format there is no need to transcode the TS files. I have put together a script that will do the job very quickly. I borrowed some code that I found in forums and on some websites. I also had a little help from the ubuntu forums to get some of the zenity options working correctly.

  This script only requires that you have previously installed dvdauthor, mkisofs, and mencoder. Some distrobutions may not already have these packages installed.

  The TS2ISO script will also require that you have some extra room on your hard disk for the new iso file and also the temp files. Generally at least double the size of the original TS file.

  When you run the script you will be asked what file you would like to convert. Then you will be asked what you would like to name the output file.

  Next you will be asked what the audio pid of the file is.

(This was due to multiple audio tracks in the stream)

  Some recordings have multiple audio in the stream and some do not.

  At this point 'mencoder' will find out the details of the video and if it has several languages in the stream. This is an example of what you will be looking for

VIDEO MPEG2(pid=4898) AUDIO MPA(pid=4899)

  If the the video and the audio pid are only one number apart you can just enter the audio pid number. If the numbers are two numbers apart, ie: 4898 and 4900 then there is more than one audio language in the stream. (maybe spanish).

 If you would like to select english then select the number between the audio pid and the video pid.

 If you would like to burn in the other language then select the actual audio pid number.

  Once the script has completed, the tmp folder will be deleted and there will be a file in the same folder that you ran the script from named "output".iso.

  You are now ready to use your favorite burning software to burn the iso to disk.

  Or if you are using nautilus you can just right click on the iso file and select 'write to disk'

  That's it.

  I have only tested this on Ubuntu but it should work in any other distribution.

  I have had trouble with older dvd players, playing the video back properly.

  Inside the script you will see that I have set the chapters to 5 minute intervals.

  As you will see in the script, it is easily changed to 10 minutes.

  I do recommend testing the script to see if the language is ok and that there are no video problems. I like to use vlc media player to test the iso files.

  If you would like to make changes to this script and submit them to me, I would gladly give credit here on my site.

 

Update:

  Added detection of user cancelation

Update:

  I finally turned this script into a nautilus script Pay close attension to the way that the audio pid is presented to the user.

  The only was I was able to make this work was to output some information to a text file and then have 'ts2iso' open the file in 'gedit' so that you can provide your audio pid. If you have a different choise of text editor you can simply change it in the script.

  Just save the script to '~/.gnome2/nautilus-scripts/', make the script is executable

chmod +x ~/.gnome2/nautilus-scripts/ts2iso

  Then all you have to do is right click on the .ts file and select Scripts>ts2iso.

 

 

PrintView Printer Friendly Version

EmailEmail Article to Friend

Reader Comments

There are no comments for this journal entry. To create a new comment, use the form below.

PostPost a New Comment

Enter your information below to add a new comment.
Author Email (optional):
Author URL (optional):
Post:
 
All HTML will be escaped. Hyperlinks will be created for URLs automatically.