LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Linux Answers > Applications / GUI / Multimedia
User Name
Password

Notices


By JoeDuncan at 2004-09-04 17:56
First of all you will need the following tools:

avidemux http://fixounet.free.fr/avidemux/ which is the VirtualDub equivalent in Linux
mjpegtools http://mjpeg.sourceforge.net/ which will actually split the files for you (it splits mpegs... but I'm getting ahead of myself...)
vcdimager http://www.gnu.org/software/vcdimager/vcdimager.html which will prepare the VCD/SVCD images for you and last but not least:
cdrdao http://cdrdao.sourceforge.net/ which will actually burn the CDs.

I have used this setup for awhile and it works beautifully for me. All of these pieces of software should be available as a binary package for your distribution.

Ok, the first thing you have to know is that (S)VCDs are MPEGs, not AVIs, so you have to convert from AVI to MPEG. This is where Avidemux comes in. You use it to save the audio and video into different streams (demultiplex) of the proper format to merge (multiplex) back in to an MPEG.

So, open Avidemux (I use version 2.0.24 so yours may be a bit different) and load your avi file (File->Open or the "Open" button on the toolbar).

Then click on the "Video Filter" button on the left.

In the "Video Filters" box, select either "SVCD res" or "VCD res" depending on which one you are going to make (I have found that a 700 mb avi splits almost evenly across 2 SVCDs).

Then click close.

Now click on the "Video Codex" button on the left toolbar. Select either "SVCD" or "VCD" for your codec and click "OK"

Then click on the "Video Process" button, this will tell Avidemux to only process the video.

Now click on "File->Save->Save Video" and enter "filename.m1v" for the file name to save as. Now sit back and wait, as this usually takes 2-3 hours on my P3 1.4 GHz machine (your mileage may vary - I usually do this part overnight)...

Ok, that takes care of splitting off (demultiplexing) the video. Now for the audio...

The first thing you want to do is to click on the "Info" button on the toolbar and then select the "audio" tab in the info box. If it says "variable" or "VBR" in there anywhere, then your AVI file is using variable bit rate audio, and you will need to build a timemap or you will have audio sync problems.. but don't worry, building a time map is easy, just select "Audio->Build VBR Time map". That will usually take about 10 minutes... Also take a note of the frequency of the audio.

Next, click on "Audio Filter" in the left toolbar. Select "Normalize" (to adjust the volume to a standard level) and then either no resampling, "44.1 to 48 kHz resampling" (usually this one as most AVIs are in 48000 hz frequency, or if your audio is already in 44100 or 48000hz frequency, enter "44100" in the "Resample to hz" box. Then click OK.

Ok, now click on "Audio Codec" on the left toolbar.

Select "FFmpeg mpeg audio" as your codec and then click "Configure"

Select a bit rate of 224kbits/second and stereo sound and click OK twice.

Now, click "Audio Process" on the left toolbar (to tell Avidemux to only process audio).

Then select "Audio->Save Audio" and enter "filename.mp2" as your audio stream file name and click ok. This will approx 30 minutes (again on my P3 1.4 GHz...)

Ok, now we have split our file we need to recreate the video as an mpeg. Close Avidemux and open up a console.

In the console (make sure you are in the right directory) type this:

mplex -S 790 -f 4 -o filename.mpg filename.m1v filename.mp2

What this says is to remultiplex your two streams into filetype 4 (-f 4) which is SVCD, with output file (-o) called "filename.mpg". The "-S 790" tells it to split the created MPEG into files that will each fit on a CD. (-S means size, although I'm not sure what the units are, it's not megabytes, but 790 fits perfectly onto one standard blank CD). IIRC it adds a "1" or "2" or "3" after the filename if it has to split them...

(-f 1 will tell it to make VCDs)

This should only take about 5 minutes.

Now, once you have your completed MPEGs, test them with your favorite video viewer. All should be well. If the audio is slightly out of sync, this can be corrected by deleting the audio track and recreating it with Avidemux, but using the "Time shift" filter option to shift the audio X milliseconds, then remultiplexing.

Ok, now you have your MPEG videos, you need to burn them to CD. So create the (S)VCD image like so (you will have to do them one at a time if your file has been split):

vcdimager -t svcd filename.mpg

This will create a file called "videocd.cue" which is the (S)VCD image. (Use "-t vcd20" to create VCDs).

Then you can burn your image like so:

cdrdao write --device /dev/scd0 videocd.cue

Now your SCSI dev file for your burner may be different, just sub yours in. Also, you may need to make your regular user part of your distros "CDRW" (or equivalent) user group in order to access the writer properly.

That should do it. Also, note that Avidemux can be called entirely from the command line (see their website for the appropriate switches for all the functions mentioned above) which should allow you to create a completely automated script to do all of this for you.

Avidemux is an awesome tool, it will also let you edit the AVIs themselves (remove bad frames, append videos etc...)

Good luck!

by Read_Icculus on Fri, 2004-10-08 03:37
Followed this thread exactly, everything works fine up until I have to multiplex and I get the following error on multiple AVI (divx, vvid) files that I followed the process on.

Code:
   INFO: [mplex] mplex version 2.2.1 ($Date: 2002/02/04 19:06:14 $)
**ERROR: [mplex] File filename.m1v unrecogniseable!
   INFO: [mplex] File filename.mp2 looks like an MPEG Audio stream.
**ERROR: [mplex] Unrecogniseable file(s)... exiting.
Then if I put the audio stream first as an argument I get this -

Code:
   INFO: [mplex] mplex version 2.2.1 ($Date: 2002/02/04 19:06:14 $)
   INFO: [mplex] File filename.mp2 looks like an MPEG Audio stream.
**ERROR: [mplex] File filename.m1v unrecogniseable!
**ERROR: [mplex] Unrecogniseable file(s)... exiting.
Is it my version of mplex? Any help would be great, I have no clue. I've tried other various vcd/svcd tools as well, tovid from this forum, divx2svcd, and have had no luck with any of them. Tovid gives me errors about "can't play stream, make sure your computer is fast enough", when mplayer works fine for everything. divx2svcd says "skipping frames" and produces garbage.

Does any other tool work at all for making vcds? I've been lookingon freshmeat and searching here. Nothing seems to work properly.

by sk545 on Sat, 2004-10-09 11:50
What distro are you running? Also, did you see the reply in the other thread from wapcaplet? I am using mplex version 2.2.3 and it seems to be working fine. I ran into a hiccup with avidemux where it wouldn't encode the audio and had to change the option to 'none' in avidemux's audio filters. After that, mplex worked.

But i would definetly upgrade mjpegtools in my distro before going any further if i were you.

by Read_Icculus on Sun, 2004-10-10 04:53
mjpegtools was the problem. I grabbed a new rpm of mjpegtools and everything worked perfectly. The multiplexing step was what went wrong with every single VCD/encoding program I tried in the end. Just didn't have the experience to recognize the errors and stuff generated by the different programs. Thanks for the help! Works perfectly now. Pretty simple now that I've got the hang of it.

by sk545 on Sun, 2004-10-10 10:10
Yah, it is simple. Just keep in mind it isn't perfect yet, so you will run into problems every now and then.

by akudewan on Wed, 2004-10-20 07:30
Is there any way of determining the split-point in a video with avidemux? I want SVCDs to have a split at every 690 MB. How do I do that?

by TrevorR on Mon, 2004-11-01 06:45
I'm having a similar problem. Instead of splitting it in two, I'm getting a 790, a 13.9 and another about 80 something. Why 3 files? How to get around this?

by akudewan on Tue, 2004-11-02 00:15
I still havent found the answer, but I came up with a rather silly solution, it works though. This is what I do:

The linux "split" command can split mpegs retaining all ability to play the files and seek in the file. Inspite of this, I must warn you that it may not work.

Lets assume you have a movie that is divided into the following files:
1) part1.mpg size: 800MB
2) part2.mpg size: 200MB

Now you wish to burn these on 700MB CDs.

Use the following command:
Code:
split -b 690m part1.mpg
This will split part1.mpg into 690MB chunks, do a "man split" to find more.

After executing this command, you will find two files named xaa and xab. Rename these to your choice, say part1-1.mpg and part1-2.mpg. Test them out and see if they work.

You can burn the first CD of 690MB with ease using vcdimager. The second CD, however must be burnt with two files, namely part1-2.mpg and part2.mpg. I have never been able to do this in linux. I burn the CDs with more than one video files in windoze using nero.

You can wine nero, or if anyone know a method of burning these in linux, then please post it here.

Maybe you can use k3b, but I have never been able to use k3b for burning VCDs

by sk545 on Tue, 2004-11-02 16:59
You could try this for 2 videos:

To add many MPEG files on the same Video CD, just have to add them on the command line:
% vcdimager -t vcd2 -c image.cue -b image.bin file1.mpg file2.mpg file3.mpg
http://www.bsdnews.org/01/vcd.php

Then just burn image.bin with k3b or whatever else.

But i doubt that the split command splits the mpegs properly though...you would better be off using this tool for svcd's:
http://mpgtx.sourceforge.net/

by Brain Drop on Sun, 2004-11-28 21:17
According to the mplex man page, -S option is NOT for splitting vcd/svcd's, it can cause problems. This split must come from marker placed by the encoder. That is why you get 3 files sometimes, it splits where you specify with the -S, and at the marker put in at the avidemux stage which seems to be at 839.

Please fix this to help save hair.

by sueno on Mon, 2005-06-13 14:28
About the three files problem I just use cat

as in:
cat firstfile.mpg secondfile.mpg > totalfile.mpg


This command merges the files again and it hasn given me any problem yet and it impssible to se where the vido was split before

Hope this helps


  



All times are GMT -5. The time now is 05:44 PM.

Main Menu
Advertisement
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