Skip to content

Converting Analogue Video Cam Movies to Digital Video With Linux.

I recently dug out my old Camcorder to shoot some local interest stuff.
This got me thinking, can I attach my camera to my PC and convert the video to mpg or avi?
The answer is yes I can, and below is a quick guide to how I achieved it.

First thing you need is a Video Capture card which can connect to your camera, usually with Composite or S-Video.
Older analogue cameras are less likely to have a digital output, such as Firewire.
My camera is a Hitachi VM-E360E, which only has composite output.

I used Mandriva Spring 2009, but the guide should be easy to adapt to other distros.
There are three apps I use to do the capture/ conversion.

Please note that this guide assumes that your capture card is working with your distro.
If you are having problems you will have to check elsewhere for a fix, there are just too many options to offer here.

For capture I use XdTV which hasn't been maintained for two years, but I find it does the job for me.
It and is available from the Mandriva Repositories.

When you first open XdTV, you are presented with it's input screen, and nothing else.

XdTV Input Screen

XdTV Input Screen

I must admit that this isn't very helpful, since there are no options visible from here.
To get to the options menu you just right click anywhere in this window.

XdTX Main Options

XdTX Main Options

There are several options here, but to keep things simple leave everything as default except for three.
These will be The TV Norm, Video Source and Frequency table.

TV Norm should be set to the standard of your camera, in my case PAL.
To change this you click on the word β€œPAL” and you will be offered the available options PAL, NTSC etc.
Incidentally this is the same method used to change all the options in these menus.

Video Source is the type of connection you are using, again click on the option to change.

Frequency table need only be set if you are going to watch Television. This is set to your local TV Frequency table.

You can leave all the other options as default for now.

At this point it is probably a good idea to to make sure things are working ok.
Connect your camera to the card and press play, with luck you should see the output from your camera in the Input Screen.

OK now you have output from your camera, I'll go through the capture process.

Firstly you need to access the Video Recorder Options Menu.
To get there In the Main Actions section of the Options Window click on Record Movie and Select Video Parameters from the drop down menu.

XdTX Video Recorder Options

XdTX Video Recorder Options

There are a great deal of options hidden here. These are my settings. 

Personally I prefer uncompressed Video and Audio for capturing with this method.
I only have a single core processor at present, and if I compress while capturing, I tend to have dropped frames.
Secondly the results from transcoding with XdTV are not very good in my opinion.
I get better results using ffmpeg outside of XdTV. Your mileage may vary.

A word of caution, Uncompressed AVIs produce very large files, about 1 GB for every 3 minutes of video.
XdTV splits these into 4 gig blocks which have to be merged together, but I will go into that later.

The one setting you will have to set here is the output path and file name.
A little irritant here is that in order to edit the file name you have to keep the mouse pointer over the edit window.
This is common throughout XdTV.

There is also a similar options window for Audio Options which is accessible from here.

When you have finished setting your options click Apply, Save & Close to go back to the main Options window. 

You are now ready to start your capture.

This is straight forward. To start recording click on Record Movie and select Record Start from the drop down menu.
To end select Record Stop.

You should then see a pop up window with information about your recording.

XdTX Results

XdTX Results

If you have re-encoded your video on the fly, you are can go straight to editing.
I recommend using Avidemux, which I will cover briefly in the next part.

If you have used uncompressed Video/ Audio, you will need to re-encode and possibly merge your files.
As an example lets assume you have captured 8 minutes of video, you will end up with the following files.

Capture_1.avi (4.0 GB)
Capture_2.avi (2.8 GB)
Capture.avi (4.0GB)

The first section of video is actually the third file listed, so to get them in the correct order I would re-name this one Capture_0.avi

This is my method for converting the files.

At this point you could fire up Avidemux and do your conversion from there.
Being lazy, setting all the options each time is something I'd rather avoid.
I prefer to use ffmeg from the command line.

Ffmpeg comes with some very good built in defaults, especially for converting to mpeg.
To convert our our files to a dvd compatible mpeg2 for instance we would use the commands:

ffmpeg -i Capture_0.avi -target pal-dvd Capture_0.mpg
ffmpeg -i Capture_1.avi -target pal-dvd Capture_1.mpg
ffmpeg -i Capture_2.avi -target pal-dvd Capture_2.mpg

Since the videos are only up to about 3 minutes long this doesn't take long.
Also using this command, the video files created are suitable for use in DVD authoring tools such as DVD Styler and Q DVD Author.
This is beyond the scope of this guide.

I stream video to my Xbox 360, which will play xvid, so the command I use is:

ffmpeg -i input.avi -vcodec libxvid -b 850k -acodec libmp3lame -ab 128k output.avi

As you can see these commands are fairly simple, I save them in a text file and cut and paste them to my Terminal.

Further ffmpeg options can be found here.

Other options for command line conversion are mencoder, transcode, Handbrake etc.
I don't think the defaults give as good results and you have to add further options to improve the video.
This can make the commands somewhat complicated.

Before going further I want to insert a rule here.

DO NOT DELETE ANY FILES UNTIL YOU ARE COMPLETELY HAPPY WITH YOUR FINAL PRODUCT.

Believe me it is really annoying to cock things up at this point and have to start again!


We now need to merge and edit our video, for this I recommend Avidemux.
It is also cross platform available for GNU/Linux, Mac, and Windows, under GPL.
It is available in most distros repositories.

Avidemux

Avidemux

We now need to merge and edit our video, for this I recommend Avidemux. In my opinion this is the best linear video editor around for cutting and splicing video files. It is also cross platform available for GNU/Linux, Mac, and Windows, under GPL. It is available in most distros repositories.
Once you have opened Avidemux, load your first file, Capture_0.mpg, either using File>Open or clicking the Open icon on the tool bar.
At this point the app may detect that you have Capture_1.mpg and Capture_2.mpg in the same folder and ask if you want to append them, you can say Yes.
If you are not asked you can use File>Append to add them.
In this case I am using mpegs so Avidemux will ask if you want to index them, you must say Yes or the video will not load.

To save your merged video, you use the setting on the left of the screen.
Leave Video and Audio as Copy and use the drop down menu under Format to set the container type.
If it's an avi file, leave it as it is, but for mpeg you should select MPEG-TS (A+V), if you select MPEG Video no audio will be copied.
Click save in the tool bar and you will be asked to give the merged file a file name, lets call it Capture_Full.mpg.
Click save in the bottom right hand corner, and the file will save, it'll take a minute or two.

At this point you may want to cut out parts of your video.
I don't want to go into details here, but put simply go to the first frame you want to delete and click the 'A' on the bottom tool bar.
Next go to the final fram you want to remove and click the 'B'. You then use Edit>Cut to remove that section.

A rule you should be aware of is that the first frame of your video has to be a b-type frame.
So if you are cutting out the start of you file, go to the last fram you want to remove then click the β€œ>>” in the bottom tool bar before clicking on 'B'.
Save your edited file as something like Capture_Full_Edit.mpg.

That's it.

I hope this has been of help.

Comment and suggestions are welcome.

Usul

23/07/2009




Hello world!

Hi just setting things up here, playing with look and feel type things, so things will probably look different next time you visit. Cool first blog complete.