Easy Linux Analogue Composite Video Capture - How to.

Write tutorials and howtos in here
There are more tutorials here http://community.linuxmint.com/tutorial/welcome
Forum rules
Do not start a support topic here please. Before you post please read this

Easy Linux Analogue Composite Video Capture - How to.

Postby Mad_Sunday on Sat Sep 18, 2010 2:20 pm

Edit...Composite video (with good quality and "in sync" audio) capture in Linux has been somewhat of a holy grail for some time. Try googling for "linux analogue video capture" (which is probably how you got here) or search on youtube, and all you will find are methods that use command line tools. That can be a daunting task, especially for newbies. This method involves NO TYPING, just a copy and paste, followed by a press of the Enter key. The second time you use it you only need to press the "up arrow" key and then the enter key. I will be editing this how to as I learn more and hope it is of use to the Linux community.

Hi, this has been a NIGHTMARE that has taken me FOREVER to get to work. I have tried SEVERAL types of TV/Capture card (pci and usb) and many different distro's and programs (mythtv, mplayer, tvtime etc. etc.) all with no real success. However, today, after many months of trying, I managed to get it working VERY simply :-)

So, to save anyone else the hassle of struggling to get your composite video source (Sky Plus box, Set top box, VCR, Camcorder, Xbox, PS3 etc. etc.) viewable or recorded on your PC please use this guide with my blessing. I am going to list the stuff I did that eventually worked. My system is running an Intel LGA775 board with a (pre-historic) Pentium D dual core processor, 2 GB ram and Mint 9 standard Gnome version, but it should work with any Ubuntu 10.04 based distro or any other distro with similar kernel specs. Kindly post here about the distro you tried with this info, is it working, not working, what you did to make it work etc.

1 Get a Hauppauge PVR-150 pci TV/capture card (I'm sure the other PVR's ie 250, 350, 500 will do the same job but I got a PVR-150) which can be bought on ebay easily enough, (ENSURE YOU GET THE RIGHT ONE FOR YOUR REGIONS TV, ie here in the UK you need a PAL version, there are loads of new ones on eBay that are NTSC so no good to me). These are FULLY supported in Linux AND have a MPEG hardware encoder on board (saving your processor work). I have tried MANY other TV/Capture cards (pci and USB) which cost more money but did not work (ie Video AND audio) for me, save your money and get one of these! Install the card into your PC and check that it is working OK using the dmesg command. Connect your video source to the card using the video and audio connectors. These cards are NOT able to receive Digital (DVB) TV and so are becoming obsolete and therefore cheap! :-) I can now confirm this howto works fine with the PVR-250 card too

2 Use synaptic (Package Manager) to install ivtv-utils, (in some distro's its just ivtv and described as Tools) If you don't have VLC media player installed use synaptic to install that too.

3 In a terminal type (might be a good idea to copy and paste this command) v4l2-ctl -d /dev/video0 -i 2

and press the enter key (note 2 is Composite, 1 is S-video, 0 is TV-tuner)

You will get a reply saying input is now composite. (*note..if you get a card setup error check the dmesg list for missing firmware issues.)

This is the ONLY bit of command line jiggery-pokery/witchcraft you need to do, so you can now close the terminal.

Tip :- The next time you open the terminal just press the up arrow key and the command will magically appear, and you can just press the enter key. If you continue pressing the up arrow all previous commands will appear in the reverse order that you have entered them.

4 Start playing your composite source device, open VLC media player and go to Media/Open Capture Device. In the menu box that opens change the Capture Mode to PVR, change NOTHING else and click play. You should now see and hear (God knows how long it's taken me to get audio :-) ) your composite signal.

5 Right click on the VLC screen and select View/Advanced Controls this will give you a RECORD button (hallelujah) and clicking it will record directly to your home directory (or home/videos etc.) as a mpeg file. Just click record again to stop the recording.

6 There is an option in the VLC Tools/Preferences/Video window to force video aspect ratio, I changed this to 16:9 so everything displays wide screen.

7 Once the file is on your hard drive you can simply play it as is, or load it into Kdenlive (video editor, also available in synaptic) using the Project/Add Clip option, drag it to the time line and edit it. Finally use the render option to save in whatever format you choose. (see note 9 below)

8 The change of input command and the selection of PVR as the source device in VLC will need to be used each time you reboot, I have no idea (yet) of how to make these options permanent.

9 As this card has native mpeg with a resolution of 720 x 576 (4:3 PAL), and no way of knowing via a composite signal if your source is wide screen, your files will try to play in the old 4:3 screen size, you can force the 16:9 option in VLC as stated above and they will play perfectly. If however you want to have them play as a native wide screen file, you can do this in Kdenlive BEFORE editing and rendering. Import the file using the Project/Add Clip option and once the clip is loaded right click on it, and choose Clip Properties/Advanced and check the Force Pixel Aspect Ratio box, and type in 1.42 (that's the recommended setting but if it doesn't look right try different settings). Then drag your clip to the top time line and cut out the bits you don't want (adverts etc.) drag the bits left together and render them using whatever file type you want (you may need to install some un-stripped libraries for some types so see the Kdenlive Forum for info on Kdenlive usage)

Due to problems with lip sync AFTER editing captured files I have started using Avidemux rather than Kdenlive to edit and alter files, see added post below.

Enjoy :-)

Pete

Update, sometimes you might get an issue with firmware files not being loaded/in the wrong place/corrupted, if so you can find them here http://www.ivtvdriver.org/index.php/Firmware just download/extract and put the files where they need to be. That's often lib/firmware and you will need root access.
Last edited by Mad_Sunday on Mon Jan 07, 2013 9:12 am, edited 16 times in total.
User avatar
Mad_Sunday
Level 2
Level 2
 
Posts: 91
Joined: Mon Jun 29, 2009 6:14 pm
Location: Staffordshire, England

Linux Mint is funded by ads and donations.
 

Also working with PCLinuxOS 2010

Postby Mad_Sunday on Thu Oct 28, 2010 4:03 am

Tested with PCLinuxOS on 28th October 2010 and still works perfectly using the above instructions.

Also now using a new Media PC with the following specs, Asus AT3N7A-I motherboard with on board Intel atom 330 dual core processor and Nvidia ION graphics chipset. 2gb ram (256kb shared memory for graphics) and only 1 PCI slot, which of course holds the PVR 150 card :-)

Despite the capture side working flawlessly, I had real problems getting good video playback (horizontal tearing of the picture, and the previous system had similar issues, which I was not able to get right in Linux Mint) with most video files, hence the trial with PLinuxOS which played them fine from the live disk! so I installed that.

I have had to dump PCLinuxOS due to numerous problems and came back to Mint. I have installed LMDE and I'm running the XFCE desktop. The playback issues are fixed by installing the Nvidia VDPAU drivers and running Smplayer for HD playback (720p). I have not been able to get VLC media player to work with VDPAU for HD playback (which is very jerky) but SMplayer setup to use VDPAU its fine

Pete
Last edited by Mad_Sunday on Sat Nov 13, 2010 3:41 pm, edited 2 times in total.
User avatar
Mad_Sunday
Level 2
Level 2
 
Posts: 91
Joined: Mon Jun 29, 2009 6:14 pm
Location: Staffordshire, England

Re: Easy Linux Analogue Composite Video Capture - How to.

Postby tinca on Thu Oct 28, 2010 4:23 am

Mad_Sunday

do you ever have lip-sync problems

Best regards Keith
Case Antec 900 | Motherboard Abit ip35 Pro | CPU Q6600 (GO) | PSU Zippy P5L-6720P | Graphic Card XFX 7300 GS | Cooler Corsair T50 water cooled cpu | Ram 2x1GB sticks | Monitor Samsung Syncmaster 323t
tinca
Level 4
Level 4
 
Posts: 319
Joined: Sun Jan 11, 2009 9:23 am
Location: England U.K.

Re: Easy Linux Analogue Composite Video Capture - How to.

Postby Mad_Sunday on Thu Oct 28, 2010 6:28 pm

Not since getting the PVR 150. I have had some terrible lip-sync probs when trying cards that have a loop back cable from the capture card back into the line in of the sound card. What are you having the issues with? Are you using a PVR card?

Pete
User avatar
Mad_Sunday
Level 2
Level 2
 
Posts: 91
Joined: Mon Jun 29, 2009 6:14 pm
Location: Staffordshire, England

Re: Easy Linux Analogue Composite Video Capture - How to.

Postby tinca on Fri Oct 29, 2010 4:41 am

Mad_Sunday

The problems that I used to have with lip-sync I solved by running every recording from the TV through "Projectx". That is always my first step.

Best regards Keith
Case Antec 900 | Motherboard Abit ip35 Pro | CPU Q6600 (GO) | PSU Zippy P5L-6720P | Graphic Card XFX 7300 GS | Cooler Corsair T50 water cooled cpu | Ram 2x1GB sticks | Monitor Samsung Syncmaster 323t
tinca
Level 4
Level 4
 
Posts: 319
Joined: Sun Jan 11, 2009 9:23 am
Location: England U.K.

Re: Easy Linux Analogue Composite Video Capture - How to.

Postby Mad_Sunday on Thu Nov 04, 2010 4:46 pm

tinca wrote:Mad_Sunday

The problems that I used to have with lip-sync I solved by running every recording from the TV through "Projectx". That is always my first step.

Best regards Keith


Hello again and thanks for the tip Keith. I suspect the use of the hardware encoder on these PVR cards is the main reason there is not a problem with regard to lip-sync, if you are using software encoding and/or an audio loop lead, that definitely increases the probability of error.
I've added a rather poor video on youtube that you might like to take a look at and there is a link edited into the original post above. Unfortunately the video was shot with my camera phone which itself has terrible lip-sync issues :-)

Pete
User avatar
Mad_Sunday
Level 2
Level 2
 
Posts: 91
Joined: Mon Jun 29, 2009 6:14 pm
Location: Staffordshire, England

Re: Easy Linux Analogue Composite Video Capture - How to.

Postby Mad_Sunday on Mon Jan 17, 2011 8:01 pm

This is an update due to issues with lip sync after editing/rendering files.

I have been having a few problems with lip sync AFTER editing and rendering my mpeg capture files. This seems to be a real problem for lots of people. The original captures from VLC seem fine, the problems occur after these files have been altered. After some experimenting I think I may have found a solution. I've begun using Avidemux which is available via synaptic. This looks to be much easier than Kdenlive to use (maybe its not so powerful?) and initial trials seem to indicate much less lip sync problems. If you have a look at the Avdemux website and search for lip sync there is quite a bit of interesting info re the PVR cards. It seems that the mpeg file is not exactly ideal, and that some programs lose the audio/video sync. However, it appears that VLC can cope better than most. Avidemux adds some markers to the file and is therefore better at keeping things together. Settings took a little head scratching at first but I seem to have found some that work. There is also a VERY useful looking audio offset setting which perhaps can re-align files you already have? Anyway, here is the way I'm setting it up.

Start Avidemux and load your captured mpeg file with the "Open" button. It will open a box which says "looks like a mpeg file do you want to index it" choose yes. The file will be loaded and timing index marks will be added (to lock the audio/video sync).

Under the Video tab I selected MPEG-4 ASP (Xvid). For audio I'm using AAC (Faac). Format is AVI. You can of course select whatever you prefer for these.

To get the output from 4:3 to 16:9 took a bit more experiment, but I changed the Video/Configure tab aspect ratio to 64 wide by 45 high. Remember the 1.42 pixel offset from Kdenlive? 64 divided by 45 is as close as I could get. 16 x 11 is close but you get a small gap top and bottom.

To edit out adverts etc. is really easy, just drag the time line button to the first point you want to cut and click edit/add point A. Then move the button to the end cut point and click edit/add point B. Next press the delete key and that bits gone!

Click save, choose a file name and location, that's it.

If you want to be sure its working OK before waiting for the whole thing to finish click the abort button and abort the save, You can then view aborted "small" file.

Pete
User avatar
Mad_Sunday
Level 2
Level 2
 
Posts: 91
Joined: Mon Jun 29, 2009 6:14 pm
Location: Staffordshire, England

Re: Easy Linux Analogue Composite Video Capture - How to.

Postby NikR on Thu Mar 01, 2012 9:33 am

Thanks for the How To. I'm running Debian Squeeze and have had extreme difficulty getting video from my PVR-500's composite/RCA input. dmesg confirmed the card/drivers were installed but I could not figure out how to control which input to capture. These steps work for me. Thanks again!
NikR
Level 1
Level 1
 
Posts: 1
Joined: Thu Mar 01, 2012 8:51 am

Re: Easy Linux Analogue Composite Video Capture - How to.

Postby artx2013 on Fri May 10, 2013 12:22 am

Thanks for helping to rescue me from the same nightmare that you were having! :-) Using your clues, I made this tutorial for doing Linux video capture with VLC player and ArtistX Linux live DVD.

What you need:

Linux ArtistX live DVD. You don't need to install Linux to your hard drive. Just run it from your DVD drive.

I tried several other Linux live CDs and live DVDs, but ArtistX was the only one that I was successful with.

Linux ArtistX DVD can be downloaded from here(3.8 GB):

http://artistx.org/blog/download/



VLC media player 2.05 or later version (which is already installed in ArtistX).

A VCR.

A composite video cable, an RCA stereo audio cable, connected from the output connectors of your VCR to the input connectors of your computer.

If you are using a Linux distribution (not ArtistX) which does not already have ivtv-utils installed,

you will need to install ivtv-utils using your Linux package manager. v4l2-ctl is part of ivtv-utils.

In the package manager of some Linux distributions, ivtv-utils may simply be called ivtv.

Your computer needs to have one of the video capture cards which are supported by the ivtv drivers.

Here's the list of supported video capture cards:

http://ivtvdriver.org/index.php/Supported_hardware

The hardware I used was:

HP Media PC, 2 GB of RAM, Haupauge WinTV PVR-150 video capture card.





1. Insert the Linux ArtistX live DVD into your DVD-ROM drive and boot your computer.

If your computer is not set up to boot to your DVD-ROM drive, then you will need to change the settings in your computer's BIOS/Setup program.

In my computer, the ArtistX DVD was not able to boot from my DVD writer drive, for some unknown reason,

but it did boot successfully from the DVD-ROM drive.



2. After Linux opens, check to see if your video capture card has been detected by Linux:

Select Applications, System tools, Preferences, Video4Linux control panel.



3. Set the default video input of your video capture card, and set the default audio input of your video capture card.

I did not see any user-friendly GUI to do this, so I needed to use the v4l2-ctl terminal program.

(Terminal = console = command line. These words have approximately the same meaning.

V4l2 means Video for(4) Linux version 2. That is a lower case letter L between the 4 and the 2 in v4l2-ctl, not the number 1.)

Open a Linux terminal program: Select Applications, System Tools, XTerm (or UXterm).



Type v4l2-ctl --all (Then press ENTER on your computer keyboard). This displays the available information about your video capture card.



Here are the commands that you need to list all of the video and audio inputs of your video capture card,

or to display the current video and audio inputs of your video capture card,

or to set the video and audio inputs to the integer number which represents that input.

(The listed video inputs, for example may be Tuner 0, S-Video 1, Composite 2.

The listed audio inputs may be Tuner 0, Line In 1 1, Line In 2 2. Write down this information for your convenient reference.)



v4l2-ctl --all display all information available about your video capture card

v4l2-ctl --list-inputs display the list of all video inputs of your video capture card

v4l2-ctl --list-audio-inputs display the list of all audio inputs of your video capture card

v4l2-ctl --get-input display the current video input of your video capture card

v4l2-ctl --set-input=<num> set the video input to <num>

(For example, type v4l2-ctl --set-input=2 then press ENTER to set your video input to Composite video.)

v4l2-ctl --get-audio-input display the current audio input of your video capture card

v4l2-ctl --set-audio-input=<num> set the audio input to <num>

(For example, type v4l2-ctl --set-audio-input=2 then press ENTER to set your audio input to Line In 2.)

v4l2-ctl -h or v4l2-ctl --help display the v4l2-ctl help message

clear clears the console



Here is the list of the command switches which are available for the V4l2-ctl program:

http://ivtvdriver.org/index.php/V4l2-ctl

http://ivtvdriver.org/index.php/V4l2-ctl_%28Examples%29



4. a) Open VLC Player: Select Applications, Video, Capture/Play/Streaming/TV, VLC Media Player.



b) Display VLC player's advanced controls: Select View, Advanced controls.



c) Set the save directory for your captured video file in preferences:

Select Tools, Preferences, Input&Codecs, Beside "Record directory or file name", select Browse...

Browse to the directory where you wish to save your video file.

(Assigning a name to the recorded video file is not necessary, because VLC player will automatically

assign a name for you which you can change later.) Click "Save" to save this new preference.



d) Select Media, Open Capture Device... Then under the "Capture Device" tab, select PVR as the capture mode. Select Play.

With your VCR cassette playing and your computer speakers turned on, you should see and hear your VCR video being played in VLC player.



5. Click on the red circle record button to start recording. Click on the red circle record button again to stop recording.

Find your captured video file in the directory that you had selected in your VLC preferences in step 4 above.

(While VLC player is recording, the record button will appear slightly darker.)







A few additional notes:



To change the desktop screen resolution of your monitor:

In the bottom left corner, select Applications, System tools, System settings, Displays.



To shut down (or restart or suspend) ArtistX:

Click on the bottom right icon, then Shut Down... (or Restart... or Suspend...)



30 minutes of captured mpeg2 video = about 1.5 to 2 GB.



In addition to being able to do video capture, the Linux ArtistX DVD is a treasure trove of free software

which will hopefully help to cheer you up after the headache of trying to figure out how to do video capture in Linux.

I hope that this tutorial was helpful!
artx2013
Level 1
Level 1
 
Posts: 2
Joined: Fri May 10, 2013 12:15 am

Re: Easy Linux Analogue Composite Video Capture - How to.

Postby artx2013 on Fri May 10, 2013 2:15 am

My tutorial is also here, with easier-to-read text formatting:

Tutorial: Video capturing VHS using Linux (ArtistX Live DVD and VLC player)
http://forum.videohelp.com/threads/3558 ... -player%29

Identical tutorial, other location:
http://forum.videohelp.com/threads/3558 ... -player%29
artx2013
Level 1
Level 1
 
Posts: 2
Joined: Fri May 10, 2013 12:15 am

Re: Easy Linux Analogue Composite Video Capture - How to.

Postby Quasimodo on Fri Jun 14, 2013 4:56 am

:D Great stuff - I bought myself a Hauppauge WinTV PVR-150 on Ebay for GBP13.99 (then had to shell out best part of GBP20 at Maplin for the necessary connecting cables...), loaded the card into my PC, installed the software as recommended, and I was rolling. Already rescued a couple of videos which we took with our VHS-C camcorder last century ;) - the next project will be to rescue some *Betamax* recordings (yes, I still have a Betamax video recorder...) ready to transfer them to DVD.

Ian
Running Linux Mint13, dual processor dual-core Opteron 2GHz, 8GB RAM, 150GB WD Raptor + 1.3TB RAID-5 array
Quasimodo
Level 1
Level 1
 
Posts: 39
Joined: Mon Oct 31, 2011 9:18 am
Location: Newbury, Berkshire, UK

Re: Easy Linux Analogue Composite Video Capture - How to.

Postby mvwhyatt on Sat Nov 23, 2013 8:20 pm

Thank you.

I was looking for a better front-end than mplayer run from the command line.
I do have to use ivtv-tune -c <channel> from the command-line to change channels.

Linux Mint Maya MATE on Dell Dimension 8400 (about 9 yrs old)
ivtv-tune 1.50
ivtv-utils 1.4.1-2ubuntu1
v4l-utils 0.8.6-1ubuntu2
VLC media player 2.0.8 Twoflower
mvwhyatt
Level 1
Level 1
 
Posts: 2
Joined: Sat Oct 12, 2013 11:16 am

Linux Mint is funded by ads and donations.
 

Return to Tutorials / Howtos

Who is online

Users browsing this forum: No registered users and 5 guests