Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
02-21-2006, 05:43 AM
|
#1
|
Member
Registered: Jun 2004
Posts: 124
Rep:
|
Converting mpeg4 to mpeg2 (mpeg4 to dvd)
I've captured some VHS video using a TV card and mencoder. Here's the command I used:
mencoder -tv driver=v4l:width=768:height=576 \
-ovc lavc -lavcopts vcodec=mpeg4:vbitrate=350:vhq:vqmax=31:keyint=300 \
-oac mp3lame -lameopts cbr:br=48 \
-vf crop=720:540:24:18,pp=lb,scale=384:288 -sws 1 -o output.avi tv://
So the video has been scaled down to 384x288. Incidentally, this leaves me with a 153MB file.
I could also use the command:
mencoder -tv driver=v4l:width=768:height=576 \
-ovc lavc -lavcopts vcodec=mpeg4:vbitrate=900 \
-oac mp3lame -lameopts cbr:br=64 \
-vf crop=720:544:24:16,pp=lb -o output.avi tv://
This would avoid rescaling, although I'm sure I've read that you don't actually gain anything from recording VHS at 768x576 (or in this case 720x544) since the quality isn't that good to begin with. (NB: for anyone who's interested, these commands are from: http://www.mplayerhq.hu/DOCS/HTML/en/tv-input.html)
Anyway, whichever command I use, I'm left with an mpeg4. I want to convert that into a VOB (and AOB?) file so it can be played on a home DVD player (not just a computer's DVD player).
This is where I'm stuck. I tried tovid-interactive (as recommended here), but it seems to want to scale the video back up to 768x576 and threatens to take ~3000 hours to do it. Does anyone know how I can convert the mpeg4 to mpeg2/VOB using transcode (or even capture straight to mpeg2/VOB using mencoder)? Comments on resolution are also welcome (eg can/should I make the DVD at 384x288 ... or must I use 768x576?). Thanks!
|
|
|
02-21-2006, 09:22 AM
|
#2
|
Senior Member
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
|
I usually use ffmpeg for this; it's much simpler and faster:
ffmpeg -i somefile.avi -y -target ntsc-dvd -aspect 16:9 -b 1800 somefile.mpg
Increase your video bitrate ("-b 1800" in the example to improve quality, but don't go over 5000). If your source is 4:3, update the aspect ratio in the example. All other attributes are set automatically by the '-target ntsc-dvd".
|
|
|
02-21-2006, 07:07 PM
|
#3
|
Member
Registered: Dec 2003
Location: Mississippi, USA
Distribution: Fedora
Posts: 435
Rep:
|
This may be an utterly stupid suggestion because I'm just learning about this topic, but could you encode directly to mpeg2 by using
-lavcopts vcodec=mpeg2video:vbitrate=900
Check the mencoder manpage and search for "vcodec=" to find all the options for the vcodec parameter.
|
|
|
02-21-2006, 07:47 PM
|
#4
|
LQ Guru
Registered: Jan 2002
Posts: 6,042
Rep: 
|
I do not reommend recording using a lossy codec like MPEG-4 when trying to output an MPEG-2.
Example capturing straight to a DVD compatible format from a TV source:
mencoder -tv driver=v4l:width=768:height=576 -oac lavc -ovc lavc -of mpeg -mpegopts format=dvd -vf scale=720:576,harddup -srate 48000 -af lavcresample=48000 -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=5000:keyint=15:acodec=ac3:abitrate=192 :aspect=4/3 -ofps 25 -o movie.mpg tv://
The example above needs a very, very fast computer because it will only do about 8 frames per second on my Pentium 4 2.0 GHz (Northwood core) with 512 MB of RAMBUS memory. This means you need at least a computer that is three times faster than mine. You can get a MPEG-1/2 encoder card like Hauppauge PVR-250 (model 980).
I recommend using a lossless compression like huffyuv or something similar to it. Then use the command above or even better ffmpeg. I suggest using at least two hard drives in RAID level 0 and XFS as the filesystem.
|
|
|
02-28-2006, 03:44 AM
|
#5
|
Member
Registered: Jun 2004
Posts: 124
Original Poster
Rep:
|
Macemoneta: Thanks for the suggestion. Unfortunately, ffmpeg returned: Unsupported codec (id=0) for input stream #0.0
jcliburn: I'm in the same boat as you. I'll try it out and report back.
Electro: I don't have those sort of resources for this project. Do many people have a machine "about three times faster" than a 2.0GHz? Last time I checked, a single core 6.0GHz required massively overclocking something in the 3.6GHz range. And liquid nitrogen to cool it. 
|
|
|
02-28-2006, 09:34 AM
|
#6
|
Senior Member
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
|
Quote:
Originally Posted by conn-fused
Macemoneta: Thanks for the suggestion. Unfortunately, ffmpeg returned: Unsupported codec (id=0) for input stream #0.0
|
Have you installed the "All" codecs package from here? There is an included README file with installation instructions.
|
|
|
02-28-2006, 01:45 PM
|
#7
|
LQ Guru
Registered: Jan 2002
Posts: 6,042
Rep: 
|
Quote:
I don't have those sort of resources for this project. Do many people have a machine "about three times faster" than a 2.0GHz? Last time I checked, a single core 6.0GHz required massively overclocking something in the 3.6GHz range. And liquid nitrogen to cool it.
|
Yes, few people own it, but is not from Intel. AMD Athlon FX-57 or Athlon FX-60 is close to three times faster.
It was a 3.2 GHz Pentium 4 (Prescott core) overclocked to 7 GHz with liquid nitrogen. It is not stable enough play games, so it will be impossible to use for video recording.
|
|
|
03-03-2006, 03:14 AM
|
#8
|
Member
Registered: Jun 2004
Posts: 124
Original Poster
Rep:
|
OK, here are commands that will go from VHS -> MPEG2 -> DVD (thanks for that idea jcliburn) :
mencoder -tv driver=v4l:width=352:height=288 -oac lavc -ovc lavc -of mpeg -mpegopts format=dvd -vf scale=352:288,pp=lb,harddup -srate 48000 -af lavcresample=48000 -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=5000:keyint=15:acodec=ac3:abitrate=192 :aspect=4/3 -ofps 25 -o YourMovie.mpg tv://
Now create an xml file that you can pass to dvdauthor. If you don't need menus or chapters (just drop in and play), this is as easy as:
Code:
<dvdauthor dest="dvd/">
<vmgm />
<titleset>
<titles>
<pgc>
<vob file="YourMovie.mpg" />
</pgc>
</titles>
</titleset>
</dvdauthor>
dvdauthor -x dvdauthor.xml
mkisofs -dvd-video -o YourMovie.iso dvd/
Then burn the resultant iso to dvd using a utility like k3b.
VHS converted to DVD in this way has worked in all the players I've tested so far. As a bonus, it's not too hard on the processor. I've even done it successfully on an 800Mhz Pentium.
I hope this helps someone! If I'm feeling ambitious later, I'll wrap this up in some perl:Tk and create a little GUI for VHS2DVD that will accept the length of the movie and stop mencoder at the right time. Otherwise, you have to pay attention to what you're capturing and interrupt mencoder when it's done.
Last edited by conn-fused; 03-03-2006 at 03:15 AM.
|
|
|
03-03-2006, 03:57 PM
|
#9
|
LQ Guru
Registered: Jan 2002
Posts: 6,042
Rep: 
|
Quote:
Originally Posted by conn-fused
OK, here are commands that will go from VHS -> MPEG2 -> DVD (thanks for that idea jcliburn) :
mencoder -tv driver=v4l:width=352:height=288 -oac lavc -ovc lavc -of mpeg -mpegopts format=dvd -vf scale=352:288,pp=lb,harddup -srate 48000 -af lavcresample=48000 -lavcopts vcodec=mpeg2video:vrc_buf_size=1835:vrc_maxrate=9800:vbitrate=5000:keyint=15:acodec=ac3:abitrate=192 :aspect=4/3 -ofps 25 -o YourMovie.mpg tv://
Now create an xml file that you can pass to dvdauthor. If you don't need menus or chapters (just drop in and play), this is as easy as:
Code:
<dvdauthor dest="dvd/">
<vmgm />
<titleset>
<titles>
<pgc>
<vob file="YourMovie.mpg" />
</pgc>
</titles>
</titleset>
</dvdauthor>
dvdauthor -x dvdauthor.xml
mkisofs -dvd-video -o YourMovie.iso dvd/
Then burn the resultant iso to dvd using a utility like k3b.
VHS converted to DVD in this way has worked in all the players I've tested so far. As a bonus, it's not too hard on the processor. I've even done it successfully on an 800Mhz Pentium.
I hope this helps someone! If I'm feeling ambitious later, I'll wrap this up in some perl:Tk and create a little GUI for VHS2DVD that will accept the length of the movie and stop mencoder at the right time. Otherwise, you have to pay attention to what you're capturing and interrupt mencoder when it's done.
|
jcliburn added an incompatible DVD format. Again people still ignore my posts. I post the correct format that I got from mplayer's documentation.
An 800 MHz computer can not and I'll repeat again can not handle MPEG-2 encoding from a TV capture card because the inefficiencies of the ffmpeg code.
A proper DVD format have to be 640x576 or 720x576 for PAL. You can get by using 352x288 but not all DVD players will work with it.
I recommend using ffvhuff, a lossless codec based on Huffyuv that is supposely 20% smaller than Huffyuv that uses YV12, Then do the encoding to DVD. You can use avidemux to edit it.
For dvdauthor, you just need to type 'dvdauthor -o finaldvd YourMovie.mpg ; dvdauthor -T finaldvd'. The option -T is not in the manual but it is recommended to make the DVD work. Always after dvdauthor is done try testing to find out if it actually works.
mplayer -dvd-device finaldvd dvd://
If it works you can just put it on a DVD. Putting it through an ISO file is useless. Just make sure the directories VIDEO_TS and AUDIO_TS is on the DVD.
|
|
|
03-04-2006, 11:00 AM
|
#10
|
Member
Registered: Jun 2004
Posts: 124
Original Poster
Rep:
|
Quote:
jcliburn added an incompatible DVD format. Again people still ignore my posts. I post the correct format that I got from mplayer's documentation.
An 800 MHz computer can not and I'll repeat again can not handle MPEG-2 encoding from a TV capture card because the inefficiencies of the ffmpeg code.
A proper DVD format have to be 640x576 or 720x576 for PAL.
|
This just isn't true. Look at the mplayer docs here:
http://www.mplayerhq.hu/DOCS/HTML/en...t-vcd-dvd.html
As you can see, 720x576, 704x576, 352x576, and 352x288 (Mpeg2) are all valid PAL formats.
Quote:
You can get by using 352x288 but not all DVD players will work with it.
|
I haven't found one of these DVD players yet, and based on the formats I posted above, it looks like it would be non-standard. Anyway, people can test these commands on their own players if they're interested. Your suggestions may provide superior results, but if no one has a machine capable of implementing them, what help do they provide?
|
|
|
All times are GMT -5. The time now is 03:16 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|