Video re-encoding question for the experts :)

Forum: LinuxTotal Replies: 3
Author Content
techiem2

Sep 11, 2009
4:00 PM EDT
So I've started the project to take our family collection of old tapes and convert them to DVDs.

I got my mencoder recording scripts updated and fixed. I record to 720x480 mp2 with ac3 audio. This gives me nice, easy to edit video files. (Side note: dvbcut is wonderful!)

The only problem is that they tend to be a tad too large to go on DVD (2 hours is a bit over 5GB), and the standard dvd creation tools available (I've been testing devede, qdvdauthor, tovid, and dvdstyler) don't automatically re-encode to fit the disc (though I THINK tovid might, but I need to test it some more to be sure).

Is there a simple way to have ffmpeg/mencoder re-encode a video file to a target filesize? Or a script to calculate new settings based on target filesize then do the re-encode?

Thanks!

Mark II
azerthoth

Sep 11, 2009
5:15 PM EDT
Somewhere in your mencoder script there should be a place that sets bit rate, nudge that down a bit.

as to slimming down the existing files vlc can do the job nicely. This link will show you the basics, it just needs a little tweaking to make it work for you. http://tom.zickel.org/vlcmp4/

Last I used devede it would resize, however there is also mandvd that has worked for me in the past as well.

techiem2

Sep 12, 2009
4:48 PM EDT
mandvd looks interesting. I'll add it to the list of progs to play with. I looked around at the info and decided to hack out a perl script to do the resizing for me. So far so good. My one issue is trying to figure out how to tell the actual size of the audio stream in the original file so I can get the max video bitrate for the conversion as high as possible (and get as close to my target filesize as possible). Obviously multiplying the listed bitrate from midentify and multiplying by the file length doesn't give an accurate number since I believe the audio is VBR, so my calculated max video bitrate ends up lower than it needs to be.

Any suggestions?

Thanks!

When I figure all this out I'll post it on the blog. :P
techiem2

Sep 12, 2009
7:17 PM EDT
Ok, I think I got is as good as I'm able to.

http://techiem2.net/index.php?/archives/23-Linux-Video-Recor... Kind of explains it a bit.

The scripts are at http://www.techiem2.net/files/recording.tar.gz

Basically I ended up ripping the audio stream out with ffmpeg in order to read its size so I could do the rest of the calculations. :P Any improvements are of course welcome. It seems to work fairly well. My 4660MB video file that I told it convert to 2000MB came out at 1931MB. I figure that's not too bad, vbr considered.

You cannot post until you login.