Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy home page: puppylinux.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Tue 09 Feb 2010, 09:27
All times are UTC - 4
 Forum index » House Training » Users ( For the regulars )
How to capture video?
Moderators: Flash, Ian, JohnMurga
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
Page 1 of 2 Posts_count   Goto page: 1, 2 Next
Author Message
tommckellips

Joined: 31 Oct 2005
Posts: 32

PostPosted: Mon 18 Feb 2008, 02:24    Post_subject:  How to capture video?  

Has anyone got some good advice on getting video capture working. I have been through VLC ffmpeg, mplayer with no sucess. I can play local files and even stream them out on the network but I can not get anything to grab video from my capture device I am trying to get video from the composite port.. Anyone know what I am messing up?
[img] http://www.geocities.com/tommckellips/pics/IMG_0002.png [/img]
[img] http://www.geocities.com/tommckellips/pics/IMG_0003.png [/img]
Back to top
View user's profile Send_private_message 
linuxcbon

Joined: 09 Aug 2007
Posts: 367
Location: here

PostPosted: Mon 18 Feb 2008, 18:55    Post_subject:  

did you try "cat /dev/video" ?
Back to top
View user's profile Send_private_message Visit_website YIM 
tommckellips

Joined: 31 Oct 2005
Posts: 32

PostPosted: Mon 18 Feb 2008, 19:11    Post_subject:  

Did that and got an endless stream of stuff.
Back to top
View user's profile Send_private_message 
linuxcbon

Joined: 09 Aug 2007
Posts: 367
Location: here

PostPosted: Mon 18 Feb 2008, 19:17    Post_subject:  

It means it works Very Happy
Try cat /dev/video > test.avi
Wait for 10 seconds and type CTRL+C to finish capture
Open test.avi with xine.
Back to top
View user's profile Send_private_message Visit_website YIM 
tommckellips

Joined: 31 Oct 2005
Posts: 32

PostPosted: Mon 18 Feb 2008, 19:48    Post_subject:  

Tried that and it gives me the engine failed to start - no demuxer found stream format not recognized.
Back to top
View user's profile Send_private_message 
linuxcbon

Joined: 09 Aug 2007
Posts: 367
Location: here

PostPosted: Mon 18 Feb 2008, 22:04    Post_subject:  

Try other players like vlc to open that video, or rename it to test.mpg ...
Back to top
View user's profile Send_private_message Visit_website YIM 
tommckellips

Joined: 31 Oct 2005
Posts: 32

PostPosted: Mon 18 Feb 2008, 22:17    Post_subject:  

I have VLC and had no luck with it at all, also mplayer no luck either, I do not see in it where to start a capture. This may help I have been trying different formats with ffmpeg with no good results yet, other than some actually create a file while others do not. I also get responses on cat /dev/video and cat /dev/video0
Here is a screen capture:
# ffmpeg -f video4linux -i /dev/video0 /root/testing.avi
FFmpeg version SVN-r7400, Copyright (c) 2000-2006 Fabrice Bellard, et al.
configuration: --prefix=/usr --libdir=/usr/lib --mandir=/usr/man --disable-bug --enable-mp3lame --enable-a52 --enable-gpl --enable-shared --enable-pp --eble-amr_nb --enable-amr_nb-fixed --enable-amr_wb --enable-pthreads --enable-dt--enable-faac --enable-faad --enable-libogg --disable-audio-beos
libavutil version: 49.1.0
libavcodec version: 51.28.0
libavformat version: 51.7.0
built on Apr 3 2007 14:43:22, gcc: 3.4.4
[video4linux @ 0xb7f102a0]Bad capture size (0x0) or wrong time base (25)
/dev/video0: Error while opening file
# ffmpeg -f yuv4mpegpipe -i /dev/video0 /root/testing.avi
FFmpeg version SVN-r7400, Copyright (c) 2000-2006 Fabrice Bellard, et al.
configuration: --prefix=/usr --libdir=/usr/lib --mandir=/usr/man --disable-bug --enable-mp3lame --enable-a52 --enable-gpl --enable-shared --enable-pp --eble-amr_nb --enable-amr_nb-fixed --enable-amr_wb --enable-pthreads --enable-dt--enable-faac --enable-faad --enable-libogg --disable-audio-beos
libavutil version: 49.1.0
libavcodec version: 51.28.0
libavformat version: 51.7.0
built on Apr 3 2007 14:43:22, gcc: 3.4.4
/dev/video0: Error while opening file
# ffmpeg -f yuv4mpegpipe -i /dev/video /root/testing.avi
FFmpeg version SVN-r7400, Copyright (c) 2000-2006 Fabrice Bellard, et al.
configuration: --prefix=/usr --libdir=/usr/lib --mandir=/usr/man --disable-bug --enable-mp3lame --enable-a52 --enable-gpl --enable-shared --enable-pp --eble-amr_nb --enable-amr_nb-fixed --enable-amr_wb --enable-pthreads --enable-dt--enable-faac --enable-faad --enable-libogg --disable-audio-beos
libavutil version: 49.1.0
libavcodec version: 51.28.0
libavformat version: 51.7.0
built on Apr 3 2007 14:43:22, gcc: 3.4.4
/dev/video: Error while opening file
# ffmpeg -f video4linux -i /dev/video0 /root/testing.mpg
FFmpeg version SVN-r7400, Copyright (c) 2000-2006 Fabrice Bellard, et al.
configuration: --prefix=/usr --libdir=/usr/lib --mandir=/usr/man --disable-bug --enable-mp3lame --enable-a52 --enable-gpl --enable-shared --enable-pp --eble-amr_nb --enable-amr_nb-fixed --enable-amr_wb --enable-pthreads --enable-dt--enable-faac --enable-faad --enable-libogg --disable-audio-beos
libavutil version: 49.1.0
libavcodec version: 51.28.0
libavformat version: 51.7.0
built on Apr 3 2007 14:43:22, gcc: 3.4.4
[video4linux @ 0xb7eef2a0]Bad capture size (0x0) or wrong time base (25)
/dev/video0: Error while opening file
#
THis folowing one acts like it is doing something, but never creates a file.
# ffmpeg -f mpeg -i /dev/video /root/testing.mpg
FFmpeg version SVN-r7400, Copyright (c) 2000-2006 Fabrice Bellard, et al.
configuration: --prefix=/usr --libdir=/usr/lib --mandir=/usr/man --disable-debug --enable-mp3lame --enable-a52 --enable-gpl --enable-shared --enable-pp --enable-amr_nb --enable-amr_nb-fixed --enable-amr_wb --enable-pthreads --enable-dts --enable-faac --enable-faad --enable-libogg --disable-audio-beos
libavutil version: 49.1.0
libavcodec version: 51.28.0
libavformat version: 51.7.0
built on Apr 3 2007 14:43:22, gcc: 3.4.4

This one has really stumped me.
Back to top
View user's profile Send_private_message 
tommckellips

Joined: 31 Oct 2005
Posts: 32

PostPosted: Mon 18 Feb 2008, 23:08    Post_subject:  

Ok 30 some odd hours later I got it to work. This site (which I just found) is a wealth of information. http://www.linuxtv.org/v4lwiki/index.php/TV_Recording
THe magic line to make my video capture work is :

ffmpeg -async 12 -vd /dev/video -ad /dev/dsp -f avi -r 25 -s 720x576 -croptop 8 -cropbottom 8 -cropleft 8 \
-cropright 8 -sameq -aspect 4:3 -acodec mp2 -ac 2 -ab 224k -ar 48000 -y -t 04:30:00 outfile.avi

The only problem is now I have no audio. This is a new issue to resolve since my sound card does work. Cat /dev/dsp does bring up a lot of stuff so I know that part is working. I'll start simple and check my feeds from the stereo and go from there. I'll post my findings or any more questions I have.
I am sure this can be made more to my needs but at least this made it work. Thanks for your help, your comments did point me in the right direction.
Back to top
View user's profile Send_private_message 
jamesbond

Joined: 26 Feb 2007
Posts: 297
Location: Chatswood, NSW

PostPosted: Tue 19 Feb 2008, 01:41    Post_subject:  

Congrats on your TV capture finally working. I didn't know ffmpeg can do capture - wow !

As for audio - I would like to share something that hopefully can help to point you to the right direction. I have a PCMCIA TV card and had a hard time got it working with tvtime, but finally it did. But no sound - same problem as yours.

After further reading, I found out that my tv card drivers does not directly channel its sound through /dev/dsp. In fact, it creates a new ALSA device (listed /proc/asound/cards) that provides sound capture. So, for my case, to be able to hear sound, I need to do sound-capture from my tv card's alsa sound dev, and straight away play it back to my actual m/b soundcard. This did the trick:

Code:
sox -r 32000 -w -t alsa hw:1,0 -t alsa hw:0,0


(got this info from http://www.linuxtv.org/v4lwiki/index.php/Saa7134-alsa)

Unfortunately for my case, my tv card only expose its sound capture device as ALSA, so I can't see how I can ever access it via the /dev/dspxxx interface thing that ffmpeg needs. I'm sure that there is a way for force ALSA to expose this to its OSS /dev/dspxxx interface, but I'm not an alsa guru Sad

Alternatively, what you can do is to capture video and audio separately, and combine them later with ffmpeg. Not the ideal solution, though.

_________________
My guide dog is FatDog2 Beta2. Puppy user since 2.13
Back to top
View user's profile Send_private_message 
linuxcbon

Joined: 09 Aug 2007
Posts: 367
Location: here

PostPosted: Tue 19 Feb 2008, 05:35    Post_subject:  

Of course ffmpeg can record videos !
It can also convert any sound and video formats !


Quote:
http://ffmpeg.mplayerhq.hu/ffmpeg-doc.html#SEC3
FFmpeg can grab video and audio from devices given that you specify the input format and device.

ffmpeg -f oss -i /dev/dsp -f video4linux2 -i /dev/video0 /tmp/out.mpg

Note that you must activate the right video source and channel before launching FFmpeg with any TV viewer such as xawtv (http://bytesex.org/xawtv/) by Gerd Knorr. You also have to set the audio recording levels correctly with a standard mixer.
Back to top
View user's profile Send_private_message Visit_website YIM 
jamesbond

Joined: 26 Feb 2007
Posts: 297
Location: Chatswood, NSW

PostPosted: Tue 19 Feb 2008, 06:14    Post_subject:  

Thanks linuxcbon. Can ffmpeg capture straight from alsa (rather than oss) ?
_________________
My guide dog is FatDog2 Beta2. Puppy user since 2.13
Back to top
View user's profile Send_private_message 
linuxcbon

Joined: 09 Aug 2007
Posts: 367
Location: here

PostPosted: Tue 19 Feb 2008, 06:46    Post_subject:  

when you type ffmpeg , it shows all the options. Smile
-f option means "force format".

You can try
Code:
 ffmpeg  -i /dev/dsp -i /dev/video0 testfile.mpg
Back to top
View user's profile Send_private_message Visit_website YIM 
tommckellips

Joined: 31 Oct 2005
Posts: 32

PostPosted: Tue 19 Feb 2008, 23:03    Post_subject:  

I Figured out why my sound did not work. /dev/dsp appears to be pointed at my mic in and not my line in. I switched the stereos audio output to my PC's mic input and now I get audio and video capture. I also found I have to capture at 352x288 if I do anything larger my sound and video loose sync. This is on a Dell with a PIII 733 and 256 meg RAM.
Now my big problem is how do I compress the video capture on the fly, I my capture creates an avi but 48 minutes of video creates a avi file that is over 1.5 gig. It looks like it is supposed to be able to compress the video but I have not been able to make that work yet.
Back to top
View user's profile Send_private_message 
tommckellips

Joined: 31 Oct 2005
Posts: 32

PostPosted: Wed 20 Feb 2008, 20:14    Post_subject:  

Now that I have spent another day trying to learn the ins and outs of ffmpeg I have another question. How do I force it to use the line in side of my audiocard? It picks up fine off the mic side but the audio quality is not as good as the line in side if I could get part to work. Line in does work in other applications so I am assuming this is something that needs set in ffmpeg.
Back to top
View user's profile Send_private_message 
tempestuous

Joined: 10 Jun 2005
Posts: 3651
Location: Australia

PostPosted: Wed 20 Feb 2008, 23:46    Post_subject:  

I see a major shortcoming in your instructions so far: no video compression specified. This will result in very large uncompressed video files, but more importantly, will require a high datarate (possibly 25MB per sec) and your hard drive won't keep up.

Here's how to encode using MPEG2 video compression, with MP2 audio compression.
Code:
ffmpeg -vd /dev/video -ad /dev/dsp -s 352x288 -vcodec mpeg2video -acodec mp2 test.mpg

Note the ".mpg" file suffix. MPEG2 will not work properly in any other type of file container.
And note that I specified a modest resolution: 352x288, to keep the demand on the CPU reasonable.
Be careful what resolution you specify: the MPEG1 and MPEG2 codecs will only work with resolutions divisible by 16.

Or here's how to encode using MPEG4 (same as XviD or DivX) video compression, with MP3 audio compression.
Code:
ffmpeg -vd /dev/video -ad /dev/dsp -s 352x288 -vcodec mpeg4 -acodec libmp3lame test.avi

Note that the correct container format is "avi". It could also be ".mp4" but to be fully MP4 compliant the audio encoding should then be "-acodec libfaac".
MPEG4/MP3 encodings will demand more from the CPU than MPEG2/MP2, so to help the CPU situation you could consider using uncompressed audio. Thus -
Code:
ffmpeg -vd /dev/video -ad /dev/dsp -s 352x288 -vcodec mpeg4 -acodec pcm_s16le test.avi

If you are unhappy with the filesize, you could drop the audio bit depth to 8, but still remain uncompressed, like this -
Code:
ffmpeg -vd /dev/video -ad /dev/dsp -s 352x288 -vcodec mpeg4 -acodec pcm_u8 test.avi
Back to top
View user's profile Send_private_message 
Display_posts:   Sort by:   
Page 1 of 2 Posts_count   Goto page: 1, 2 Next
Post_new_topic   Reply_to_topic View_previous_topic :: View_next_topic
 Forum index » House Training » Users ( For the regulars )
Jump to:  

Rules_post_cannot
Rules_reply_cannot
Rules_edit_cannot
Rules_delete_cannot
Rules_vote_cannot
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
hot copy
[ Time: 0.3916s ][ Queries: 8 (0.0161s) ][ Debug on ]