LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-25-2014, 07:25 PM   #1
Ron Freeman
LQ Newbie
 
Registered: Apr 2014
Posts: 4

Rep: Reputation: Disabled
Burning DVD for DVD players (non PC types)


Hi everyone/anyone,
This is my first post. I've looked at other forums for the solution but haven't seen much that helps (seems like a simple problem that many must have run into).

Problem is:
I'm trying to burn DVD's that are playable on regular DVD players (not just on PC's). In other words I need to convert MPEG type files to .vob I used OpenShot video editor to combine serval clips from a camera (.MTS type files)and then exported it as single 'DVD' file. I then tried to use k3b DVD Kreator to burn a DVD from that file. I get the following error:

K3b Version: 2.0.2
KDE Version: 4.11.5
QT Version: 4.8.4
Kernel: 3.11.0-19-generic

Used versions
-----------------------
mkisofs: 1.1.11

mkisofs
-----------------------
/usr/bin/genisoimage: No such file or directory. Failed to open VIDEO_TS.IFO
/usr/bin/genisoimage: Can't open VMG info for '/tmp/kde-ron/k3bVideoDvd0/'.
/usr/bin/genisoimage: Unable to parse DVD-Video structures.
/usr/bin/genisoimage: Could not find correct 'VIDEO_TS' directory.
Possible reasons:
- VIDEO_TS subdirectory was not found on specified location
- VIDEO_TS has invalid contents

--------------------------------------------------------------
(File/directory k3bVideoDvd0 was not created)

I'm using ubuntu 13.10 and do have genisoimage installed (but not sure about all its necessay dependencies)
I think that k3b (using genisoimage) should be creating directories: VIDEO_TS & AUDIO_TS containing .ifo and .iso/.vob files but for some reason it isn't able to. Do I need to create the directories for it myself? Doesn't seem reasonable. I have found converters apps and have generated a separte .iso file but I don't know where the .ifo files come from and the .iso files don't play by themselves in DVD players. If you can't answer my question directly maybe someone knows of a good source of info. that I could use to educate myself.

Thanks in advance
 
Old 04-25-2014, 07:39 PM   #2
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,272
Blog Entries: 28

Rep: Reputation: 6124Reputation: 6124Reputation: 6124Reputation: 6124Reputation: 6124Reputation: 6124Reputation: 6124Reputation: 6124Reputation: 6124Reputation: 6124Reputation: 6124
It seems to me the core issue here is converting the mpegs to vob, not the actual burning.

I've never done that, but this thread from the Ubuntu forums may help: http://ubuntuforums.org/showthread.php?t=1161044
 
Old 04-26-2014, 08:31 PM   #3
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD, Raspbian, Arch
Posts: 2,331

Rep: Reputation: 357Reputation: 357Reputation: 357Reputation: 357
It appears that you never "authored" the DVD. Below is how to do what you want, starting with an MPG file. This is command line stuff. No GUI's.

---

If you have your source video in a single file in MPG format, rename that to "movie.mpg":
Code:
mv your_source_file movie.mpg
Do all the following from the same directory where "movie.mpg" is located.

Run the command:
Code:
mkdir movie.dir
Then manually create a file named "movie.xml" with the following content:
Code:
<dvdauthor>
 <vmgm />
  <titleset>
   <titles>
    <pgc>
     <vob file="movie.mpg" chapters="" />
    </pgc>
   </titles>
  </titleset>
</dvdauthor>
Then run the following command:
Code:
VIDEO_FORMAT=NTSC dvdauthor -o "movie.dir" -x "movie.xml"
Insert a blank DVD into /dev/dvd0, then run the following command:
Code:
growisofs -use-the-force-luke=notray -Z /dev/dvd0 -speed=1 -dvd-video "movie.dir"
Then, enjoy your video on a standard DVD player!

[ edit: I assumed above that you are in the USA, thus my use of VIDEO_FORMAT=NTSC. If you are in Europe, change that to VIDEO_FORMAT=PAL. If you're somewhere else, change it to whatever video format your country (and your DVD player) uses. ]

Last edited by haertig; 04-26-2014 at 08:38 PM.
 
1 members found this post helpful.
Old 04-26-2014, 10:34 PM   #4
Ron Freeman
LQ Newbie
 
Registered: Apr 2014
Posts: 4

Original Poster
Rep: Reputation: Disabled
Thanks for the info. I think you're right about the problem being in the converting. I'll give ffmeg a try. It might be that the problem is in the first step of exporting the file from OpenShot editor--I exported both .dv and .avi files but get the error that it(k3b) 'doesn't have all the necessary video DVD files' plus what I posted before; so it seems that 3kb is not getting the correct files (I don't know what the necessary files are though) or that 3kb is missing some part. In doing my own research I found this very old link:

http://www.linuxquestions.org/linux/...dia/AVI_to_DVD

that describes exactly what I want to do using terminal commands. I had problems with just the first command {transcode -i ...). So I think I'll either troubleshoot this method and/or try using the genisoimage terminal command the same way. (The terminal commands give a little more feed back than using GUI 's)
I'll let you know how it goes--again thanks for your interest and help
 
Old 04-27-2014, 05:41 PM   #5
Ron Freeman
LQ Newbie
 
Registered: Apr 2014
Posts: 4

Original Poster
Rep: Reputation: Disabled
Smile Thanks--it worked

Thanks for your interst and time and most of all a succinct and accurate answer. I only had to change dvd0 to cdrom for my system. You saved me a great deal of time. I had figured out that my problem wasn't in converting but that I had completely missed the 'DVD authoring' step. I was trying the GUI Devede but it wasn't recognizing/accepting my video files even though I knew they were videos that could be seen. I didn't find any quick solution and didn't look forward to troubleshooting that GUI so I was headed to trying it from the command line. Therefore your answer couldn't have been more timely. I can now get on with my original project and experiment with the commands you sent for making titles and such--but its so much nicer starting from something that works. If you have any other posts/links/articles that would help me get smarter I'd appreciate it, otherwise I'll be happy with just using the man's and --helps for these commands.
This is my first time using this forum(or any forum) so I hope this isn't too wordy but I really do appreciate your help.
 
Old 04-27-2014, 06:49 PM   #6
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD, Raspbian, Arch
Posts: 2,331

Rep: Reputation: 357Reputation: 357Reputation: 357Reputation: 357
The commands I posted above are from a PERL script that I wrote long ago for copying DVD's (script is posted below). I didn't put any comments in the script, but if you can read PERL code, it's a very simple script. You can pick out some of the commands I used for ripping, getting chapter info, shrinking video, etc. (dvdxchap, vamps, mplayer, growisofs, dvdauthor, etc.) Those commands may be of some use to you. One note on this script: At one place I calculate a "shrinkage factor" so that I can make a 9Gb DVD fit onto a 4.5Gb DVD. That calculation is not 100% perfect. Every now and then I end up with a shrunken file that was not quite shrunk enough. That becomes obvious when the script calls growisofs and growisofs complains that things won't fit on the inserted blank DVD. No harm done, as growisofs is smart enough not to try burning your DVD when it knows things won't fit. When this fit problem happens, I go into the script and manually tweak the the calculation for the particular DVD. I do a "brute force" tweak, and you can see this near the top of the script where I set the $DVDSIZE variable. I just comment out the old defined size and substiture a new, smaller size. It's been on my ToDo list for years now to go back and fix that calculation properly, but I've just never gotten around to it. The "too big to fit" problem occurs so rarely that I haven't felt the urgency to do the proper re-work of calculating the shrinkage factor.

The script intentionally leaves its intermediate working files in the current directory, so that if you stop it in progress, or some error occurs, it can pick up from where it left off without having to start over (which can be time consuming). Sometimes you may want to really start over from scratch, and you need to remove all the intermediate files manually to accomplish that. This "pick up from where you left off" behavior is handled by the @operation and %file_to_operation_map things you see in the script. This behavior is desireable if you only have one DVD drive that you will use for both the source DVD and the destination one. You put in the source DVD, start the script, and walk away. When it gets to the burning step, that will fail because there is not a writeable DVD in the drive. Just insert a fresh DVD and start the script again. It will pick up right at the burning step. Note: Set $READ_DEVICE and $WRITE_DEVICE variables appropriately. These are found at the top of the script.

The way I determine which audio stream is the English audio strem (the one I want since I'm in the USA) is probably overkill, but it works. What I'm doing is finding the highest quality English track (the DVD might have all of 5.1 audio, stereo audio, mono audio, etc.)

You will see when I call growisofs I use the -use-the-force-luke=notray option. You will not find that documented, because, -use-the-force-luke signals an "undocumented option". What "notray" does is prevents platforms that normally eject then suck back in the DVD after it has been burned. On some platforms, a burned DVD will appear corrupt unless you eject it and reinsert it. Some platforms do this eject/re-insert step automatially. "notray" attempts to prevent that. Why? Because if you have autoplay set on your computer, when that DVD gets sucked back in, it will start playing. And if you started this copy operation and then walked away and went to bed, the last thing you want is for a DVD to start automatically playing later and wake you up.

A lot of this script has to do with pulling data off a DVD to start with, something you have not stated you needed to do. But in the end it shrinks things, authors DVDs, and burns them - all steps that you will need.

Code:
#!/usr/bin/perl

# $Id$

use English;
use Storable;


####################
# GLOBAL VARIABLES #
####################

my $INFOFILE		= 'movie.inf';	# Movie data: $TITLE, $CHAPTERS, etc.
my $RIPFILE		= 'movie.rip';	# Raw, ripped video/audio file
my $VOBFILE		= 'movie.vob';	# File stripped to single audio stream
my $MPGFILE		= 'movie.mpg';	# Stripped file shrunk to fit DVD
my $XMLFILE		= 'movie.xml';	# DVD authoring info (will be created)
my $LOGFILE		= 'movie.log';	# Logfile of all operations
my $OUTPUTDIR		= 'movie.dir';	# Output directory for re-authored DVD
my $READ_DEVICE		= '/dev/dvd';	# Device to rip from
my $WRITE_DEVICE	= '/dev/dvd1';	# Device to burn to
my $PAUSE_BEFORE_BURN	= 'yes';	# Valid settings are "yes" and "no"
my $WRITE_SPEED		= 1;		# Burn slow, for best quality
#my $DVDSIZE		= 4600000000;	# Target size to shrink video/audio to
#my $DVDSIZE		= 4550000000;	# Target size to shrink video/audio to
my $DVDSIZE		= 4500000000;	# Target size to shrink video/audio to
my $TITLE		= undef; # ask_user_title() subroutine will set this
my $AUDIO_STREAM	= undef; # get_english_audio_stream() will set this
my $CHAPTERS		= undef; # get_chapter_info() will set this
my $FACTOR		= undef; # calculate_shrink_factor() will set this


################
# MAIN PROGRAM #
################

my @operation = (
	'get_dvd_info',
	'rip_dvd',
	'strip_dvd',
	'shrink_video',
	'author_dvd',
	'burn_dvd',
);

my %file_to_operation_map = (
	undef		=> 0,
	$INFOFILE	=> 1,
	$RIPFILE	=> 2,
	$VOBFILE	=> 3,
	$MPGFILE	=> 4,
	$OUTPUTDIR	=> 5,
);

my $most_recent_file   = get_most_recent_filename();
my $starting_operation = $file_to_operation_map{$most_recent_file} || 0;

for (my $cnt = $starting_operation; $cnt <= $#operation; $cnt++) {
	&{$operation[$cnt]} || last;
}


###############
# SUBROUTINES #
###############

sub get_most_recent_filename {
	my %filedate;
	my $cnt = -1;
	foreach my $file ($INFOFILE, $RIPFILE, $VOBFILE, $MPGFILE, $OUTPUTDIR) {
		$filedate{(stat($file))[9] || $cnt--} = $file;
	}
	foreach my $key (sort {$b <=> $a} keys %filedate) {
		return $filedate{$key} if $key >= 0;
	}
	return undef;
}

sub get_dvd_info {
	ask_user_title() || exit;
	get_english_audio_stream() || ask_user_audio_stream() || exit;
	get_chapter_info() || exit;
	save_info_file() || exit;
}

sub save_info_file {
	my %settings;
	$settings{'TITLE'}        = $TITLE;
	$settings{'CHAPTERS'}     = $CHAPTERS;
	$settings{'AUDIO_STREAM'} = $AUDIO_STREAM;
	store(\%settings, $INFOFILE) || return undef;
	return 1;
}

sub load_info_file {
	my $r_settings = retrieve($INFOFILE) || return undef;
	$TITLE         = $r_settings->{'TITLE'};
	$CHAPTERS      = $r_settings->{'CHAPTERS'};
	$AUDIO_STREAM  = $r_settings->{'AUDIO_STREAM'};
	return 1;
}

sub ask_user_title {
	print "Enter TITLE to rip: ";
	$TITLE = <STDIN>;
	chomp($TITLE);
	return undef unless ($TITLE =~ /^\d+$/);
	return undef if ($TITLE <= 0);
	return 1;
}

sub get_english_audio_stream {
	my $index = 0;
	my @filtered;
	my $command = qq!mplayer -frames 0 dvd://$TITLE//$READ_DEVICE 2>&1 | egrep "^audio stream"!;
	print qq!*** EXECUTING: "$command"\n!;
	@{$filtered[$index]}   = `$command`;
	@{$filtered[++$index]} = grep(/language: en /, @{$filtered[$index]});
	@{$filtered[++$index]} = grep(/format: ac3 /,  @{$filtered[$index]});
	@{$filtered[++$index]} = grep(/ \(5\.1\) /,    @{$filtered[$index]});
	@{$filtered[++$index]} = grep(/aid: 128\.$/,   @{$filtered[$index]});
	for ( ; $index >= 0; $index--) {
		my @sorted_by_aid = sort { my ($anum,$bnum); $a =~ /aid:\s+(\d+)\.$/; $anum = $1; $b =~ /aid:\s+(\d+)\.$/; $bnum = $1; $anum <=> $bnum } @{$filtered[$index]};
		if ($sorted_by_aid[0] =~ /stream:\s+(\d+)/) {
			$AUDIO_STREAM = $1 + 1;
			return 1;
		}
	}
	$AUDIO_STREAM = undef;
	return undef;
}

sub ask_user_audio_stream {
	# Will only be called if stream # cannot be automatically determined
	print "Enter audio stream to rip (number >= 1): ";
	$AUDIO_STREAM = <STDIN>;
	chomp($AUDIO_STREAM);
	return undef unless ($AUDIO_STREAM =~ /^\d+$/);
	return undef if ($AUDIO_STREAM <= 0);
	return 1;
}

sub get_chapter_info {
	my $command = qq!dvdxchap -t $TITLE $READ_DEVICE!;
	print qq!*** EXECUTING: "$command"\n!;
	my @chapters = `$command`;
	@chapters = grep(/CHAPTER\d+=/, @chapters);
	grep(s/CHAPTER\d+=//, @chapters);
	local $LIST_SEPARATOR = ' ';
	$CHAPTERS = "@chapters";
	unless ($CHAPTERS =~ /\d+:\d+/) {
		$CHAPTERS = "0:00,5:00,10:00,15:00,20:00,25:00,30:00,35:00,40:00,45:00,50:00,55:00,60:00,65:00,70:00,75:00,80:00,85:00,90:00,95:00,100:00,105:00,110:00,115:00,120:00,125:00,130:00,135:00,140:00,145:00,150:00,155:00,160:00,165:00,170:00,175:00,180:00";
	}
	return 1;
}

sub rip_dvd {
	defined $TITLE || load_info_file() || exit;
	my $command = qq!mplayer -nocache -dumpstream -dumpfile $RIPFILE dvdnav://$TITLE//$READ_DEVICE 1>&2!;
	print qq!*** EXECUTING: "$command"\n!;
	`$command`;
	$CHILD_ERROR && return undef;
	return 1;
}

sub strip_dvd {
	defined $AUDIO_STREAM || load_info_file() || exit;
	my $command = qq!vamps -v -a $AUDIO_STREAM <"$RIPFILE" >"$VOBFILE"!;
	print qq!*** EXECUTING: "$command"\n!;
	`$command`;
	$CHILD_ERROR && return undef;
	return 1;
}

sub shrink_video {
	defined $AUDIO_STREAM || load_info_file() || exit;
	calculate_shrink_factor();
	if ($FACTOR <= 1 ) {	# No shrinkage required
		my $command = qq!ln "$RIPFILE" "$MPGFILE" 1>&2!;
		print qq!*** EXECUTING: "$command"\n!;
		`$command`;
		$CHILD_ERROR && return undef;
		return 1;
	}
	elsif ($FACTOR >= 2 ) {	# Should never need to shrink this much
		return undef;
	}
	my $command = qq!vamps -v -e $FACTOR -a $AUDIO_STREAM <"$VOBFILE" >"$MPGFILE"!;
	print qq!*** EXECUTING: "$command"\n!;
	`$command`;
	$CHILD_ERROR && return undef;
	return 1;
}

sub calculate_shrink_factor {
	my $STRIPSIZE = (stat($VOBFILE))[7];
	my $TMP = ($STRIPSIZE / $DVDSIZE);
	$FACTOR = sprintf('%.2f', $TMP); # $FACTOR > 1 will trigger shrinkage
	return $FACTOR;
}

sub author_dvd {
	open( FP, ">$XMLFILE") || return undef;
	print FP  "<dvdauthor> <vmgm /> <titleset> <titles> <pgc>\n";
	print FP  qq!<vob file="$MPGFILE" chapters="$CHAPTERS" />\n!;
	print FP  "</pgc> </titles> </titleset> </dvdauthor>\n";
	close(FP);
	mkdir $OUTPUTDIR, 0755;
	my $command = qq!VIDEO_FORMAT=NTSC dvdauthor -o "$OUTPUTDIR" -x "$XMLFILE" 1>&2!;
	print qq!*** EXECUTING: "$command"\n!;
	`$command`;
	$CHILD_ERROR && return undef;
	return 1;
}

sub burn_dvd {
	unless ($PAUSE_BEFORE_BURN =~ /^(no|0|false|)$/i) {
		print qq!Please review results, type 'burn' to continue, anything else to quit: !;
		my $user_response = <>;
		chomp $user_response;
		unless ($user_response =~ /^burn$/i) {
			return undef;
		}
	}
	my $command = qq!growisofs -use-the-force-luke=notray -Z $WRITE_DEVICE -speed=$WRITE_SPEED -dvd-video "$OUTPUTDIR" 1>&2!;
	print qq!*** EXECUTING: "$command"\n!;
	`$command`;
	$CHILD_ERROR && return undef;
	`eject $WRITE_DEVICE 2>/dev/null 1>&2`;
	return 1;
}

1;

Last edited by haertig; 04-27-2014 at 06:52 PM.
 
1 members found this post helpful.
Old 04-28-2014, 12:21 AM   #7
Ron Freeman
LQ Newbie
 
Registered: Apr 2014
Posts: 4

Original Poster
Rep: Reputation: Disabled
Thumbs up Modifying commands?

Hey that Perl script looks like it could come in handy when I get this project done. It looks pretty straight forward & easy to use--especially with your explanations. On the authoring part I'm wondering if I can simply modify the xml file by adding titles for separate video clips which brings up the question of how to add multiple clips--which I guess is the purpose of 'authoring'. BTW I haven't researched any of these commands yet so if that info is readily available don't waste your time with providing details--just point me there.
 
Old 04-28-2014, 09:43 AM   #8
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD, Raspbian, Arch
Posts: 2,331

Rep: Reputation: 357Reputation: 357Reputation: 357Reputation: 357
Some stuff on dvdauthor:

http://dvdauthor.sourceforge.net/
http://dvdauthor.sourceforge.net/doc/index.html
http://radagast.ca/linux/dvd_authori...authoring.html
http://www.kaybee.org/~kirk/dvdauthor.html
http://nfs.shawnfumo.com/wiki/DVDAuthor/XML

There are a lot of examples and documentation to be found if you search. Just search Google for "tutorial dvdauthor", "howto dvdauthor", "wiki dvdauthor", "dvdauthor xml", "how to create menus with dvdauthor", etc.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to isntall and use .iso dvd burning utility from live mint 16 DVD Downloads Folde bigapple48 Linux - Newbie 2 02-18-2014 01:13 AM
Burning dual layer dvd (DVD DL +R) fails using k3b, Nero 4 Linux, Gnome CD/DVD Creat skyxn3t Linux - General 1 09-03-2010 08:26 PM
Best free/low-cost Windows software for burning Linux iso's to CD/DVD-R CD/DVD-RW linus72 Linux - Newbie 14 04-10-2009 09:02 AM
DVD burned not readable in all DVD players. Why?! fc6_user Linux - Hardware 26 05-20-2007 03:04 AM
burning divx/xvid to dvd for play on standalone dvd player blanny Linux - General 0 12-30-2005 09:29 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:49 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration