LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 09-14-2008, 04:40 AM   #1
alkos333
Member
 
Registered: Dec 2006
Posts: 271

Rep: Reputation: 31
Convert any video file to DVD with open source tools


I've been trying to follow a tutorial on Linux.com
(http://www.linux.com/feature/53702) to create a dvd from a an mkv
file that I have. I looked up every single option was used in the
encoding command and things seem to make sense.

Here's the file I'm working with:


me@tpt60:~/downloads/complete$ mplayer -vo dummy -ao dummy -identify
movie.mkv 2>&1
MPlayer 1.0rc2-4.2.3 (C) 2000-2007 MPlayer Team
CPU: Genuine Intel(R) CPU T2500 @ 2.00GHz (Family: 6,
Model: 14, Stepping: 8)
CPUflags: MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 1
Compiled with runtime CPU detection.

Playing movie.mkv.
ID_VIDEO_ID=0
[mkv] Track ID 1: video (V_MPEG4/ISO/AVC), -vid 0
ID_AUDIO_ID=0
ID_AID_0_LANG=und
[mkv] Track ID 2: audio (A_VORBIS), -aid 0, -alang und
[mkv] Will play video track 1.
Matroska file format detected.
VIDEO: [avc1] 624x352 24bpp 29.970 fps 0.0 kbps ( 0.0 kbyte/s)
ID_FILENAME=movie.mkv
ID_DEMUXER=mkv
ID_VIDEO_FORMAT=avc1
ID_VIDEO_BITRATE=0
ID_VIDEO_WIDTH=624
ID_VIDEO_HEIGHT=352
ID_VIDEO_FPS=29.970
ID_VIDEO_ASPECT=1.7727
ID_AUDIO_FORMAT=vrbs
ID_AUDIO_BITRATE=0
ID_AUDIO_RATE=44100
ID_AUDIO_NCH=2
ID_LENGTH=5364.43
Error opening/initializing the selected video_out (-vo) device.
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 44100 Hz, 2 ch, s16le, 0.0 kbit/0.00% (ratio: 0->176400)
ID_AUDIO_BITRATE=0
ID_AUDIO_RATE=44100
ID_AUDIO_NCH=2
Selected audio codec: [ffvorbis] afm: ffmpeg (FFmpeg Vorbis decoder)
==========================================================================
Could not open/initialize audio device -> no sound.
Audio: no sound
Video: no video


Exiting... (End of file)





Since the file is not in AC3, I run the following command only for NTSC:

mencoder -oac lavc -ovc lavc -of mpeg -mpegopts format=dvd -vf
scale=720:480,harddup -srate 48000 -af lavcresample=48000 -lavcopts
vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=5000:keyint=18:aspect=19/9:acodec=ac3:abitrate=192
-ofps 30000/1001 -o movie.mpg movie.mkv

It seems to be working ok, but then it fails at 10%:



Pos: 508.9s 16819f (10%) 72.98fps Trem: 33min 1990mb A-V:0.060 [3119:192]
Too many audio packets in the buffer: (4097 in 848371 bytes).
Maybe you are playing a non-interleaved stream/file or the codec failed?
For AVI files, try to force non-interleaved mode with the -ni option.

Flushing video frames.
Writing index...

Overhead: 2.485% (5235272 / 210668984)
Writing header...

Video stream: 3119.682 kbit/s (389960 B/s) size: 198454040 bytes
508.908 secs 16819 frames

Audio stream: 192.000 kbit/s (23999 B/s) size: 12223488 bytes 509.312 secs




I also tried playing the file that it has created thus far and there
was a huge audio delay, which I can't explain either.


I'd really appreciate your help. I'm a command line person and would
like to have full control over the conversions and all the things that
I'm doing. That's why I stay away from GUIs most of the time.
 
Old 09-14-2008, 05:01 AM   #2
keefaz
Senior Member
 
Registered: Mar 2004
Distribution: Slackware
Posts: 4,437

Rep: Reputation: 93
Does your DVD player support vorbis audio ?
I mean, I would not re-encode the sound as it is already compressed with vorbis format
I would just use -oac copy, also I would test mencoder options with just a part of the movie,
say 10sec: -ss 0:20 -endpos 0:30
 
Old 09-14-2008, 05:32 AM   #3
alkos333
Member
 
Registered: Dec 2006
Posts: 271

Original Poster
Rep: Reputation: 31
Well I'm burning this for general use, not just my DVD player, so I'm trying to come with something compatible as the tutorial suggests. It converts the first 10% of the movie and I can play it. However, there's a huge audio delay.
 
Old 09-14-2008, 02:15 PM   #4
alkos333
Member
 
Registered: Dec 2006
Posts: 271

Original Poster
Rep: Reputation: 31
I tried the -ss and -endpos and it finishes without errors, but there's still a bout a 3-second audio delay in the converted video.
 
Old 09-14-2008, 02:25 PM   #5
Shadowmeph
Member
 
Registered: May 2008
Location: West Coast Canada
Posts: 254

Rep: Reputation: 28
have you tryied deVEde that is wha tI use I am not sure if it supports all formats but you could check it out
 
Old 09-14-2008, 02:35 PM   #6
disturbed1
Senior Member
 
Registered: Mar 2005
Location: USA
Distribution: Slackware
Posts: 1,133
Blog Entries: 6

Rep: Reputation: 223Reputation: 223Reputation: 223
Vorbis isn't a compliant audio format for DVD authoring.

I usually encode audio and video as separate streams, since most authoring application won't take program streams, plus I like to read the output of mplex to identify any problems.

Tovid, and devede are easy enough to use. Or the command with some options.

Code:
mkfifo video.yuv

mplayer -noconsolecontrols -benchmark -nosound -noframedrop -noautosub \
-vo yuv4mpeg:file=video.yuv movie.mkv -vf $YOUR_FILTERS \
& cat video.yuv | mpeg2enc -f 8 -p -F 1 -a 3 -n n -b 7500 -q 3 -D 9 -g 3 \
-G 12 -4 2 -2 1 -R 2 -M 2 -v 0 -o movie.m2v 

mplayer -vo null -vc null -ao pcm:fast:file=audio.wav movie.mkv

normalize audio.wav && aften audio.wav audio.ac3

mplex -f 8 -o movie.mpg movie.m2v movie.ac3
Tovid pretty much does the exact same thing I posted above wrapped in a gui, or prompted shell script. Todisc is an awesome authoring application.

I only use mpeg2enc because I've had too many DVD players barf on lavc encoded mpeg files. The mpeg2enc command line above is for 23.976 fps (-F1)with 3:2 pulldown flags added (-p) 16:9 (-a 3)
 
Old 09-14-2008, 05:30 PM   #7
glore2002
Member
 
Registered: Mar 2007
Location: Buenos Aires, Argentina.
Distribution: Debian Lenny AMD64
Posts: 506

Rep: Reputation: 32
I use DeVeDe. I am not an expert on this subject but DeVeDe works for me.

Glore2002.-
 
Old 09-14-2008, 09:10 PM   #8
alkos333
Member
 
Registered: Dec 2006
Posts: 271

Original Poster
Rep: Reputation: 31
Yes, I've tried using Devede. I'd still get audio delays and I'm a proponent of command line.
 
Old 09-14-2008, 09:13 PM   #9
alkos333
Member
 
Registered: Dec 2006
Posts: 271

Original Poster
Rep: Reputation: 31
Quote:
Originally Posted by disturbed1 View Post
Vorbis isn't a compliant audio format for DVD authoring.

I usually encode audio and video as separate streams, since most authoring application won't take program streams, plus I like to read the output of mplex to identify any problems.

Tovid, and devede are easy enough to use. Or the command with some options.

Code:
mkfifo video.yuv

mplayer -noconsolecontrols -benchmark -nosound -noframedrop -noautosub \
-vo yuv4mpeg:file=video.yuv movie.mkv -vf $YOUR_FILTERS \
& cat video.yuv | mpeg2enc -f 8 -p -F 1 -a 3 -n n -b 7500 -q 3 -D 9 -g 3 \
-G 12 -4 2 -2 1 -R 2 -M 2 -v 0 -o movie.m2v 

mplayer -vo null -vc null -ao pcm:fast:file=audio.wav movie.mkv

normalize audio.wav && aften audio.wav audio.ac3

mplex -f 8 -o movie.mpg movie.m2v movie.ac3
Tovid pretty much does the exact same thing I posted above wrapped in a gui, or prompted shell script. Todisc is an awesome authoring application.

I only use mpeg2enc because I've had too many DVD players barf on lavc encoded mpeg files. The mpeg2enc command line above is for 23.976 fps (-F1)with 3:2 pulldown flags added (-p) 16:9 (-a 3)
I don't even have such commands as mpeg2enc and yuv4mpeg. I'd like to stick to just mencoder and dvdauthor because that's all that's needed really.

Last edited by alkos333; 09-14-2008 at 09:14 PM.
 
Old 09-14-2008, 09:33 PM   #10
zoran119
Member
 
Registered: Dec 2007
Posts: 217

Rep: Reputation: 18
I take my files and convert them to .mpg using ffmpeg:
Code:
$ ffmpeg -i file.avi -target pal-dvd -aspect 4:3 file.mpg
Once I have that I use dvdauthor
Code:
$ dvdauthor -x dvdauthor.xml
Google helps with dvdauthor.xml when needed :-)
 
Old 09-14-2008, 11:23 PM   #11
alkos333
Member
 
Registered: Dec 2006
Posts: 271

Original Poster
Rep: Reputation: 31
Well mencoder has ffmpeg included in it from what I know. It should work, but it doesn't and it's becoming really frustrating and I want to get to the bottom of this.
 
Old 09-15-2008, 02:15 AM   #12
alkos333
Member
 
Registered: Dec 2006
Posts: 271

Original Poster
Rep: Reputation: 31
Quote:
Originally Posted by zoran119 View Post
I take my files and convert them to .mpg using ffmpeg:
Code:
$ ffmpeg -i file.avi -target pal-dvd -aspect 4:3 file.mpg
Once I have that I use dvdauthor
Code:
$ dvdauthor -x dvdauthor.xml
Google helps with dvdauthor.xml when needed :-)
Ok, I did

Code:
ffmpeg -i movies.mkv -target dvd -aspect 4:3 movie.mpg
And it converted. Although the delay is nowhere nearly as bad as it was after mencoder, there's still a .5-second delay and it's noticable. How do I get rid of that?
 
Old 09-15-2008, 05:38 AM   #13
glore2002
Member
 
Registered: Mar 2007
Location: Buenos Aires, Argentina.
Distribution: Debian Lenny AMD64
Posts: 506

Rep: Reputation: 32
Quote:
Originally Posted by zoran119 View Post
I take my files and convert them to .mpg using ffmpeg:
Code:
$ ffmpeg -i file.avi -target pal-dvd -aspect 4:3 file.mpg
Once I have that I use dvdauthor
Code:
$ dvdauthor -x dvdauthor.xml
Google helps with dvdauthor.xml when needed :-)

What if I want to convert it to NTSC? Do I have to write this?:

Code:
ffmpeg -i file.avi -target ntsc-dvd -aspect 4:3 file.mpg

Thanks and sorry because I wasn't who started the thread and I am asking anyway.

Glore2002.-
 
Old 09-15-2008, 09:31 AM   #14
alkos333
Member
 
Registered: Dec 2006
Posts: 271

Original Poster
Rep: Reputation: 31
No, it assumed ntsc in my case, so writing just "dvd" should suffice. NTSC seems to be the default choice.
 
Old 09-15-2008, 03:53 PM   #15
glore2002
Member
 
Registered: Mar 2007
Location: Buenos Aires, Argentina.
Distribution: Debian Lenny AMD64
Posts: 506

Rep: Reputation: 32
Quote:
Originally Posted by alkos333 View Post
No, it assumed ntsc in my case, so writing just "dvd" should suffice. NTSC seems to be the default choice.
Thanks for your reply alkos333. Do I need dvdauthor to create a DVD? If so, once I have both files (mpg and dvdauthor), What would you recommend to burn the DVD? What if I have more than one mpg file?

Thanks again for your valuable help,
Glore2002.-

Last edited by glore2002; 09-15-2008 at 03:57 PM.
 
  


Reply

Tags
avi, burn, dvd, vob


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
LXer: 8 Free, Open Source Tools for Video Playback and Encoding LXer Syndicated Linux News 0 08-25-2008 08:11 AM
LXer: Linux tools to convert file formats LXer Syndicated Linux News 0 07-22-2008 01:40 PM
FAQ : how to rip DVD and convert Video to iPod goodfriend Linux - Newbie 4 05-20-2008 11:25 PM
How to convert DVD track to Flash video format mrukjames Linux - Software 3 01-22-2008 02:21 PM
LXer: Tools and open standards through Open Source development LXer Syndicated Linux News 0 04-24-2007 01:01 AM


All times are GMT -5. The time now is 11:42 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration