LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 05-29-2010, 02:10 AM   #1
g4cli
LQ Newbie
 
Registered: Mar 2005
Distribution: Fedora Core 14
Posts: 14

Rep: Reputation: 0
Question How to play live video from USB Webcam on web page


We have a Centos 5.4 system with V4L installed. xawtv displays the web cam's output fine, but I need to find a way to embed live video from the web cam in a web page (Apache is also installed). I want to play the video in such a way that the viewers do NOT need any special software other than a standard web browser (Firefox, IE, etc.)

I'd appreciate any pointers - but please be gentle - I'm still rather a newbie!
 
Old 05-29-2010, 04:14 AM   #2
smoker
Senior Member
 
Registered: Oct 2004
Distribution: Fedora Core 4, 12, 13, 14, 15, 17
Posts: 2,279

Rep: Reputation: 248Reputation: 248Reputation: 248
You need to establish what format the video is being produced in. Can you save any and test it ? Maybe using mplayer or VLC ?

Also, your specification that the client should not need any software other than a web browser will be difficult. Do you include Flash as "special" because that is currently the only cross browser solution. HTML5 can deal with ogg video, but Microsoft products can't do ogg video without a plugin.

The general approach would be to use ffmpeg and ffserver.

ffmpeg is used to convert the video to flash or ogv and ffserver is used to stream the video, which you can then embed into a web page.

Here is an example that uses a network camera as a source :
http://www.daantje.nl/2007/05/07/con...-flash-swfflv/

Last edited by smoker; 05-29-2010 at 04:18 AM.
 
1 members found this post helpful.
Old 05-29-2010, 08:13 AM   #3
mjolnir
Member
 
Registered: Apr 2003
Posts: 671

Rep: Reputation: 68
This can be done with Opera Unite and Flash but it is a very immature application at the moment and may not serve your needs.
 
Old 05-30-2010, 05:33 AM   #4
g4cli
LQ Newbie
 
Registered: Mar 2005
Distribution: Fedora Core 14
Posts: 14

Original Poster
Rep: Reputation: 0
Smile

Quote:
Originally Posted by smoker View Post
You need to establish what format the video is being produced in. Can you save any and test it ? Maybe using mplayer or VLC ?

I can play from /dev/video in xawtv,if that helps!

Also, your specification that the client should not need any software other than a web browser will be difficult. Do you include Flash as "special" because that is currently the only cross browser solution. HTML5 can deal with ogg video, but Microsoft products can't do ogg video without a plugin.

Flash would be fine - I think that's what Youtube uses?

The general approach would be to use ffmpeg and ffserver.

ffmpeg is used to convert the video to flash or ogv and ffserver is used to stream the video, which you can then embed into a web page.

As I said, could you point me at some examples - I'm a total newbie.
I can find my way around linux and know how to compile and install
stuff, but that's about it. The example you quote below is for an Axis Network webcam (and uses proprietary Axis software, I think). Ours is a simple webcam connected by USB.

Here is an example that uses a network camera as a source :
http://www.daantje.nl/2007/05/07/con...-flash-swfflv/
I really appreciate your help!

Regards

David
 
Old 05-30-2010, 10:21 AM   #5
smoker
Senior Member
 
Registered: Oct 2004
Distribution: Fedora Core 4, 12, 13, 14, 15, 17
Posts: 2,279

Rep: Reputation: 248Reputation: 248Reputation: 248
The example uses an Axis network camera but uses no proprietary software. It uses ffmpeg and ffserver.
You need to establish what format the camera produces video as, so that you can tell ffmpeg how to convert it.

Whatever happens, it will be a hack, because without the (presumably) windows based drivers we are left with seeing what the output is, then adapting that output to your needs.

Use VLC to stream video from /dev/video and make it save it as it goes along. That way you can specify what format the saved video is in.

All that is happening in the example link I gave is this :

The axis webcam puts out a stream of jpeg images. (15 frames per second)
Curl gets those images over http and feeds them to ffmpeg
ffmpeg converts them into a flash format and feeds them to ffserver
ffserver feeds the converted video over http to the web page.

We can use the last two or three lines of that process.
We need to know how to access the video feed in line one, and what format it is in.

If it's all taking place on one machine, then there is no reason why ffmpeg can't get it's feed direct from /dev/video.
But we still need to know what the format is ideally.

It could be as simple as this :
Code:
ffmpeg -er 4 -y -r 5 -vd /dev/video http://127.0.0.1:8090/feed1.ffm
with an ffserver config (Edit /etc/ffserver.conf) like :
Code:
# Port on which the server is listening. You must select a different
# port from your standard HTTP web server if it is running on the same
# computer.
Port 8090

# Address on which the server is bound. Only useful if you have
# several network interfaces.
BindAddress 0.0.0.0

# Number of simultaneous HTTP connections that can be handled. It has
# to be defined *before* the MaxClients parameter, since it defines the
# MaxClients maximum limit.
MaxHTTPConnections 2000

# Number of simultaneous requests that can be handled. Since FFServer
# is very fast, it is more likely that you will want to leave this high
# and use MaxBandwidth, below.
MaxClients 1000

# This the maximum amount of kbit/sec that you are prepared to
# consume when streaming to clients.
MaxBandwidth 1000

# Access log file (uses standard Apache log file format)
# '-' is the standard output.
CustomLog -

# Suppress that if you want to launch ffserver as a daemon.
NoDaemon

<Feed feed1.ffm>
	File /tmp/feed1.ffm #when remarked, no file is beeing created and the stream keeps working!!
	FileMaxSize 200K
       # Only allow connections from localhost to the feed.
       ACL allow 127.0.0.1
</Feed>

# SWF output - great for testing
<Stream test.swf>
	# the source feed
	Feed feed1.ffm
	# the output stream format - SWF = flash
	Format swf
	# this must match the ffmpeg -r argument
	VideoFrameRate 5
	# another quality tweak
	VideoBitRate 320
	# quality ranges - 1-31 (1 = best, 31 = worst)
	VideoQMin 1
	VideoQMax 3
	VideoSize 640x480
	# wecams don't have audio
	NoAudio
</Stream>

# FLV output - good for streaming
<Stream test.flv>
	# the source feed
	Feed feed1.ffm
	# the output stream format - FLV = FLash Video
	Format flv
	VideoCodec flv
	# this must match the ffmpeg -r argument
	VideoFrameRate 5
	# another quality tweak
	VideoBitRate 320
	# quality ranges - 1-31 (1 = best, 31 = worst)
	VideoQMin 1
	VideoQMax 3
	VideoSize 640x480
	# wecams don't have audio
	NoAudio
</Stream>

<Stream stat.html>
	Format status
</Stream>

<Redirect index.html>
	# credits!
	URL http://ffmpeg.sourceforge.net/
</Redirect>
Then access http://127.0.0.1:8090/test.swf in a web browser.

It's bound to be more complicated but without knowing more about the situation, I can't do it from here.

Maybe if you tell us what the camera is we can find out more about it.

You also need to install ffmpeg.

Last edited by smoker; 05-30-2010 at 10:25 AM.
 
Old 06-01-2010, 12:47 AM   #6
g4cli
LQ Newbie
 
Registered: Mar 2005
Distribution: Fedora Core 14
Posts: 14

Original Poster
Rep: Reputation: 0
Wink

Quote:
Originally Posted by smoker View Post
The example uses an Axis network camera but uses no proprietary software. It uses ffmpeg and ffserver.
You need to establish what format the camera produces video as, so that you can tell ffmpeg how to convert it.

Whatever happens, it will be a hack, because without the (presumably) windows based drivers we are left with seeing what the output is, then adapting that output to your needs.

Use VLC to stream video from /dev/video and make it save it as it goes along. That way you can specify what format the saved video is in.

All that is happening in the example link I gave is this :

The axis webcam puts out a stream of jpeg images. (15 frames per second)
Curl gets those images over http and feeds them to ffmpeg
ffmpeg converts them into a flash format and feeds them to ffserver
ffserver feeds the converted video over http to the web page.

We can use the last two or three lines of that process.
We need to know how to access the video feed in line one, and what format it is in.

If it's all taking place on one machine, then there is no reason why ffmpeg can't get it's feed direct from /dev/video.
But we still need to know what the format is ideally.

It could be as simple as this :
Code:
ffmpeg -er 4 -y -r 5 -vd /dev/video http://127.0.0.1:8090/feed1.ffm
with an ffserver config (Edit /etc/ffserver.conf) like :
Code:
# Port on which the server is listening. You must select a different
# port from your standard HTTP web server if it is running on the same
# computer.
Port 8090

# Address on which the server is bound. Only useful if you have
# several network interfaces.
BindAddress 0.0.0.0

# Number of simultaneous HTTP connections that can be handled. It has
# to be defined *before* the MaxClients parameter, since it defines the
# MaxClients maximum limit.
MaxHTTPConnections 2000

# Number of simultaneous requests that can be handled. Since FFServer
# is very fast, it is more likely that you will want to leave this high
# and use MaxBandwidth, below.
MaxClients 1000

# This the maximum amount of kbit/sec that you are prepared to
# consume when streaming to clients.
MaxBandwidth 1000

# Access log file (uses standard Apache log file format)
# '-' is the standard output.
CustomLog -

# Suppress that if you want to launch ffserver as a daemon.
NoDaemon

<Feed feed1.ffm>
	File /tmp/feed1.ffm #when remarked, no file is beeing created and the stream keeps working!!
	FileMaxSize 200K
       # Only allow connections from localhost to the feed.
       ACL allow 127.0.0.1
</Feed>

# SWF output - great for testing
<Stream test.swf>
	# the source feed
	Feed feed1.ffm
	# the output stream format - SWF = flash
	Format swf
	# this must match the ffmpeg -r argument
	VideoFrameRate 5
	# another quality tweak
	VideoBitRate 320
	# quality ranges - 1-31 (1 = best, 31 = worst)
	VideoQMin 1
	VideoQMax 3
	VideoSize 640x480
	# wecams don't have audio
	NoAudio
</Stream>

# FLV output - good for streaming
<Stream test.flv>
	# the source feed
	Feed feed1.ffm
	# the output stream format - FLV = FLash Video
	Format flv
	VideoCodec flv
	# this must match the ffmpeg -r argument
	VideoFrameRate 5
	# another quality tweak
	VideoBitRate 320
	# quality ranges - 1-31 (1 = best, 31 = worst)
	VideoQMin 1
	VideoQMax 3
	VideoSize 640x480
	# wecams don't have audio
	NoAudio
</Stream>

<Stream stat.html>
	Format status
</Stream>

<Redirect index.html>
	# credits!
	URL http://ffmpeg.sourceforge.net/
</Redirect>
Then access http://127.0.0.1:8090/test.swf in a web browser.

It's bound to be more complicated but without knowing more about the situation, I can't do it from here.

Maybe if you tell us what the camera is we can find out more about it.

You also need to install ffmpeg.
Thanks for what you have told me so far. I'll get the model number
of the webcam on Thursday evening (that day and Saturday are the only days I can access the shack physically), but I have accessed the server
and here is the output of lsusb -v for the webcam:

----------------------------CUT HERE------------------------------

Bus 001 Device 002: ID 046d:0804 Logitech, Inc.
Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 2.00
bDeviceClass 239 Miscellaneous Device
bDeviceSubClass 2 ?
bDeviceProtocol 1 Interface Association
bMaxPacketSize0 64
idVendor 0x046d Logitech, Inc.
idProduct 0x0804
bcdDevice 0.09
iManufacturer 0
iProduct 0
iSerial 2 92577A60
bNumConfigurations 1
Configuration Descriptor:
bLength 9
bDescriptorType 2
wTotalLength 1549
bNumInterfaces 4
bConfigurationValue 1
iConfiguration 0
bmAttributes 0x80
MaxPower 500mA
UNRECOGNIZED: 08 0b 00 02 0e 03 00 00
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 0
bAlternateSetting 0
bNumEndpoints 1
bInterfaceClass 14 Video
bInterfaceSubClass 1 Video Control
bInterfaceProtocol 0
iInterface 0
UNRECOGNIZED: 20 41 01 0b 82 06 61 63 70 50 ab 49 b8 cc b3 85 5e 8d 22 55 01 01 04 03 01 00 00 00 00 00 00 00
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x87 EP 7 IN
bmAttributes 3
Transfer Type Interrupt
Synch Type None
Usage Type Data
wMaxPacketSize 0x0010 1x 16 bytes
bInterval 8
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 0
bNumEndpoints 0
bInterfaceClass 14 Video
bInterfaceSubClass 2 Video Streaming
bInterfaceProtocol 0
iInterface 0
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 1
bNumEndpoints 1
bInterfaceClass 14 Video
bInterfaceSubClass 2 Video Streaming
bInterfaceProtocol 0
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 5
Transfer Type Isochronous
Synch Type Asynchronous
Usage Type Data
wMaxPacketSize 0x00c0 1x 192 bytes
bInterval 1
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 2
bNumEndpoints 1
bInterfaceClass 14 Video
bInterfaceSubClass 2 Video Streaming
bInterfaceProtocol 0
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 5
Transfer Type Isochronous
Synch Type Asynchronous
Usage Type Data
wMaxPacketSize 0x0180 1x 384 bytes
bInterval 1
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 3
bNumEndpoints 1
bInterfaceClass 14 Video
bInterfaceSubClass 2 Video Streaming
bInterfaceProtocol 0
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 5
Transfer Type Isochronous
Synch Type Asynchronous
Usage Type Data
wMaxPacketSize 0x0200 1x 512 bytes
bInterval 1
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 4
bNumEndpoints 1
bInterfaceClass 14 Video
bInterfaceSubClass 2 Video Streaming
bInterfaceProtocol 0
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 5
Transfer Type Isochronous
Synch Type Asynchronous
Usage Type Data
wMaxPacketSize 0x0280 1x 640 bytes
bInterval 1
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 5
bNumEndpoints 1
bInterfaceClass 14 Video
bInterfaceSubClass 2 Video Streaming
bInterfaceProtocol 0
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 5
Transfer Type Isochronous
Synch Type Asynchronous
Usage Type Data
wMaxPacketSize 0x0320 1x 800 bytes
bInterval 1
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 6
bNumEndpoints 1
bInterfaceClass 14 Video
bInterfaceSubClass 2 Video Streaming
bInterfaceProtocol 0
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 5
Transfer Type Isochronous
Synch Type Asynchronous
Usage Type Data
wMaxPacketSize 0x03b0 1x 944 bytes
bInterval 1
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 7
bNumEndpoints 1
bInterfaceClass 14 Video
bInterfaceSubClass 2 Video Streaming
bInterfaceProtocol 0
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 5
Transfer Type Isochronous
Synch Type Asynchronous
Usage Type Data
wMaxPacketSize 0x0a80 2x 640 bytes
bInterval 1
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 8
bNumEndpoints 1
bInterfaceClass 14 Video
bInterfaceSubClass 2 Video Streaming
bInterfaceProtocol 0
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 5
Transfer Type Isochronous
Synch Type Asynchronous
Usage Type Data
wMaxPacketSize 0x0b20 2x 800 bytes
bInterval 1
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 9
bNumEndpoints 1
bInterfaceClass 14 Video
bInterfaceSubClass 2 Video Streaming
bInterfaceProtocol 0
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 5
Transfer Type Isochronous
Synch Type Asynchronous
Usage Type Data
wMaxPacketSize 0x0be0 2x 992 bytes
bInterval 1
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 10
bNumEndpoints 1
bInterfaceClass 14 Video
bInterfaceSubClass 2 Video Streaming
bInterfaceProtocol 0
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 5
Transfer Type Isochronous
Synch Type Asynchronous
Usage Type Data
wMaxPacketSize 0x1380 3x 896 bytes
bInterval 1
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 1
bAlternateSetting 11
bNumEndpoints 1
bInterfaceClass 14 Video
bInterfaceSubClass 2 Video Streaming
bInterfaceProtocol 0
iInterface 0
Endpoint Descriptor:
bLength 7
bDescriptorType 5
bEndpointAddress 0x81 EP 1 IN
bmAttributes 5
Transfer Type Isochronous
Synch Type Asynchronous
Usage Type Data
wMaxPacketSize 0x13fc 3x 1020 bytes
bInterval 1
UNRECOGNIZED: 08 0b 02 02 01 02 00 00
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 2
bAlternateSetting 0
bNumEndpoints 0
bInterfaceClass 1 Audio
bInterfaceSubClass 1 Control Device
bInterfaceProtocol 0
iInterface 0
AudioControl Interface Descriptor:
bLength 9
bDescriptorType 36
bDescriptorSubtype 1 (HEADER)
bcdADC 1.00
wTotalLength 38
bInCollection 1
baInterfaceNr( 0) 3
AudioControl Interface Descriptor:
bLength 12
bDescriptorType 36
bDescriptorSubtype 2 (INPUT_TERMINAL)
bTerminalID 1
wTerminalType 0x0201 Microphone
bAssocTerminal 0
bNrChannels 1
wChannelConfig 0x0000
iChannelNames 0
iTerminal 0
AudioControl Interface Descriptor:
bLength 9
bDescriptorType 36
bDescriptorSubtype 3 (OUTPUT_TERMINAL)
bTerminalID 3
wTerminalType 0x0101 USB Streaming
bAssocTerminal 1
bSourceID 5
iTerminal 0
AudioControl Interface Descriptor:
bLength 9
bDescriptorType 36
bDescriptorSubtype 6 (FEATURE_UNIT)
bUnitID 5
bSourceID 1
bControlSize 1
bmaControls( 0) 0x03
Mute
Volume
bmaControls( 1) 0x00
iFeature 0
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 3
bAlternateSetting 0
bNumEndpoints 0
bInterfaceClass 1 Audio
bInterfaceSubClass 2 Streaming
bInterfaceProtocol 0
iInterface 0
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 3
bAlternateSetting 1
bNumEndpoints 1
bInterfaceClass 1 Audio
bInterfaceSubClass 2 Streaming
bInterfaceProtocol 0
iInterface 0
AudioStreaming Interface Descriptor:
bLength 7
bDescriptorType 36
bDescriptorSubtype 1 (AS_GENERAL)
bTerminalLink 3
bDelay 1 frames
wFormatTag 1 PCM
AudioStreaming Interface Descriptor:
bLength 11
bDescriptorType 36
bDescriptorSubtype 2 (FORMAT_TYPE)
bFormatType 1 (FORMAT_TYPE_I)
bNrChannels 1
bSubframeSize 2
bBitResolution 16
bSamFreqType 1 Discrete
tSamFreq[ 0] 16000
Endpoint Descriptor:
bLength 9
bDescriptorType 5
bEndpointAddress 0x86 EP 6 IN
bmAttributes 5
Transfer Type Isochronous
Synch Type Asynchronous
Usage Type Data
wMaxPacketSize 0x0044 1x 68 bytes
bInterval 4
bRefresh 0
bSynchAddress 0
AudioControl Endpoint Descriptor:
bLength 7
bDescriptorType 37
bDescriptorSubtype 1 (EP_GENERAL)
bmAttributes 0x01
Sampling Frequency
bLockDelayUnits 0 Undefined
wLockDelay 0 Undefined
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 3
bAlternateSetting 2
bNumEndpoints 1
bInterfaceClass 1 Audio
bInterfaceSubClass 2 Streaming
bInterfaceProtocol 0
iInterface 0
AudioStreaming Interface Descriptor:
bLength 7
bDescriptorType 36
bDescriptorSubtype 1 (AS_GENERAL)
bTerminalLink 3
bDelay 1 frames
wFormatTag 1 PCM
AudioStreaming Interface Descriptor:
bLength 11
bDescriptorType 36
bDescriptorSubtype 2 (FORMAT_TYPE)
bFormatType 1 (FORMAT_TYPE_I)
bNrChannels 1
bSubframeSize 2
bBitResolution 16
bSamFreqType 1 Discrete
tSamFreq[ 0] 24000
Endpoint Descriptor:
bLength 9
bDescriptorType 5
bEndpointAddress 0x86 EP 6 IN
bmAttributes 5
Transfer Type Isochronous
Synch Type Asynchronous
Usage Type Data
wMaxPacketSize 0x0064 1x 100 bytes
bInterval 4
bRefresh 0
bSynchAddress 0
AudioControl Endpoint Descriptor:
bLength 7
bDescriptorType 37
bDescriptorSubtype 1 (EP_GENERAL)
bmAttributes 0x01
Sampling Frequency
bLockDelayUnits 0 Undefined
wLockDelay 0 Undefined
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 3
bAlternateSetting 3
bNumEndpoints 1
bInterfaceClass 1 Audio
bInterfaceSubClass 2 Streaming
bInterfaceProtocol 0
iInterface 0
AudioStreaming Interface Descriptor:
bLength 7
bDescriptorType 36
bDescriptorSubtype 1 (AS_GENERAL)
bTerminalLink 3
bDelay 1 frames
wFormatTag 1 PCM
AudioStreaming Interface Descriptor:
bLength 11
bDescriptorType 36
bDescriptorSubtype 2 (FORMAT_TYPE)
bFormatType 1 (FORMAT_TYPE_I)
bNrChannels 1
bSubframeSize 2
bBitResolution 16
bSamFreqType 1 Discrete
tSamFreq[ 0] 32000
Endpoint Descriptor:
bLength 9
bDescriptorType 5
bEndpointAddress 0x86 EP 6 IN
bmAttributes 5
Transfer Type Isochronous
Synch Type Asynchronous
Usage Type Data
wMaxPacketSize 0x0084 1x 132 bytes
bInterval 4
bRefresh 0
bSynchAddress 0
AudioControl Endpoint Descriptor:
bLength 7
bDescriptorType 37
bDescriptorSubtype 1 (EP_GENERAL)
bmAttributes 0x01
Sampling Frequency
bLockDelayUnits 0 Undefined
wLockDelay 0 Undefined
Interface Descriptor:
bLength 9
bDescriptorType 4
bInterfaceNumber 3
bAlternateSetting 4
bNumEndpoints 1
bInterfaceClass 1 Audio
bInterfaceSubClass 2 Streaming
bInterfaceProtocol 0
iInterface 0
AudioStreaming Interface Descriptor:
bLength 7
bDescriptorType 36
bDescriptorSubtype 1 (AS_GENERAL)
bTerminalLink 3
bDelay 1 frames
wFormatTag 1 PCM
AudioStreaming Interface Descriptor:
bLength 11
bDescriptorType 36
bDescriptorSubtype 2 (FORMAT_TYPE)
bFormatType 1 (FORMAT_TYPE_I)
bNrChannels 1
bSubframeSize 2
bBitResolution 16
bSamFreqType 1 Discrete
tSamFreq[ 0] 48000
Endpoint Descriptor:
bLength 9
bDescriptorType 5
bEndpointAddress 0x86 EP 6 IN
bmAttributes 5
Transfer Type Isochronous
Synch Type Asynchronous
Usage Type Data
wMaxPacketSize 0x00c4 1x 196 bytes
bInterval 4
bRefresh 0
bSynchAddress 0
AudioControl Endpoint Descriptor:
bLength 7
bDescriptorType 37
bDescriptorSubtype 1 (EP_GENERAL)
bmAttributes 0x01
Sampling Frequency
bLockDelayUnits 0 Undefined
wLockDelay 0 Undefined
Device Qualifier (for other device speed):
bLength 10
bDescriptorType 6
bcdUSB 2.00
bDeviceClass 239 Miscellaneous Device
bDeviceSubClass 2 ?
bDeviceProtocol 1 Interface Association
bMaxPacketSize0 64
bNumConfigurations 1
----------------------------CUT HERE------------------------------

I don't know if that helps! BTW, there IS only one machine involved
and my ffmpeg does NOT recognise the switch '-vd'!

Regards and thanks

David
 
Old 06-01-2010, 11:13 AM   #7
smoker
Senior Member
 
Registered: Oct 2004
Distribution: Fedora Core 4, 12, 13, 14, 15, 17
Posts: 2,279

Rep: Reputation: 248Reputation: 248Reputation: 248
The ffmpeg switches may need playing with, as I'm not sure whether you still need to specify -i as well as -vd. See man ffmpeg for more on that.
 
Old 06-06-2010, 01:20 AM   #8
g4cli
LQ Newbie
 
Registered: Mar 2005
Distribution: Fedora Core 14
Posts: 14

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by smoker View Post
The ffmpeg switches may need playing with, as I'm not sure whether you still need to specify -i as well as -vd. See man ffmpeg for more on that.
As I said in an earlier post that I'd get the WebCam details. It's a Logitech C250. Does that help?

Thanks for your help so far, and I apologise for the heavy going with me. I want to get into Linux, but it's proving more difficult than I initially thought - I will get there - eventually!

Regards

David G4CLI
 
Old 06-06-2010, 02:25 AM   #9
smoker
Senior Member
 
Registered: Oct 2004
Distribution: Fedora Core 4, 12, 13, 14, 15, 17
Posts: 2,279

Rep: Reputation: 248Reputation: 248Reputation: 248
Ok, here's what I've discovered.

The Logitech C250 is supported by the Linux UVC driver.
So you need to establish if you have the driver installed. Please run
Code:
lsmod | grep uvcvideo
If you get a result, then the module is installed. If not then you need to get it and install it.
Instructions for building the module are here.
Hopefully you already have it installed, although Centos/RHEL 5.4 aren't up to the kernel version where it is installed by default. It may be on the system but not loaded into the kernel.
You can try running
Code:
locate uvcvideo
and see if that shows results somewhere under /lib/modules.
You may need to update the slocate database first :
As root -
Code:
updatedb
IF the module is there, but does not show up in lsmod output, then as root run -
Code:
modprobe uvcvideo
That same site also gives an example ffmpeg command, so if or when your output of lsmod is positive, try running this command
Code:
ffmpeg -f video4linux2 -s 320x240 -r 5 -i /dev/video0 -f m4v out.m4v
This will save the camera output as mpeg4 in a file called out.m4v
You will have to stop the recording manually, usually Ctrl+C.

If you get a readable file then all we have to do is use the ffserver settings from earlier in the thread to make use of this stream, and output the ffmpeg to a stream ffserver can use. Change the test.swf section in the /etc/ffserver.conf so that the VideoSize setting is 320x240

i.e.

Code:
ffmpeg -f video4linux2 -s 320x240 -r 5 -i /dev/video0 - http://127.0.0.1:8090/feed1.ffm
and
Code:
# /etc/ffserver.conf
# Port on which the server is listening. You must select a different
# port from your standard HTTP web server if it is running on the same
# computer.
Port 8090

# Address on which the server is bound. Only useful if you have
# several network interfaces.
BindAddress 0.0.0.0

# Number of simultaneous HTTP connections that can be handled. It has
# to be defined *before* the MaxClients parameter, since it defines the
# MaxClients maximum limit.
MaxHTTPConnections 2000

# Number of simultaneous requests that can be handled. Since FFServer
# is very fast, it is more likely that you will want to leave this high
# and use MaxBandwidth, below.
MaxClients 1000

# This the maximum amount of kbit/sec that you are prepared to
# consume when streaming to clients.
MaxBandwidth 1000

# Access log file (uses standard Apache log file format)
# '-' is the standard output.
CustomLog -

# Suppress that if you want to launch ffserver as a daemon.
NoDaemon

<Feed feed1.ffm>
	File /tmp/feed1.ffm #when remarked, no file is beeing created and the stream keeps working!!
	FileMaxSize 200K
       # Only allow connections from localhost to the feed.
       ACL allow 127.0.0.1
</Feed>

# SWF output - great for testing
<Stream test.swf>
	# the source feed
	Feed feed1.ffm
	# the output stream format - SWF = flash
	Format swf
	# this must match the ffmpeg -r argument
	VideoFrameRate 5
	# another quality tweak
	VideoBitRate 320
	# quality ranges - 1-31 (1 = best, 31 = worst)
	VideoQMin 1
	VideoQMax 3
	VideoSize 320x240
	# wecams don't have audio
	NoAudio
</Stream>

# FLV output - good for streaming
<Stream test.flv>
	# the source feed
	Feed feed1.ffm
	# the output stream format - FLV = FLash Video
	Format flv
	VideoCodec flv
	# this must match the ffmpeg -r argument
	VideoFrameRate 5
	# another quality tweak
	VideoBitRate 320
	# quality ranges - 1-31 (1 = best, 31 = worst)
	VideoQMin 1
	VideoQMax 3
	VideoSize 320x240
	# wecams don't have audio
	NoAudio
</Stream>

<Stream stat.html>
	Format status
</Stream>

<Redirect index.html>
	# credits!
	URL http://ffmpeg.sourceforge.net/
</Redirect>
You need to make a web page with a flash object embedded in it that uses the ffserver output as a source.

Code:
<object width="320" height="240"><param name="movie" value="http://127.0.0.1:8090/test.swf">
<embed src="http://127.0.0.1:8090/test.swf" width="320" height="240">
</embed></object>
Now by running the following in a terminal, it should all work.

Code:
ffserver &
ffmpeg -f video4linux2 -s 320x240 -r 5 -i /dev/video0 - http://127.0.0.1:8090/feed1.ffm
try accessing the local web page you created that contains the swf object.

Last edited by smoker; 06-06-2010 at 02:55 AM.
 
Old 06-06-2010, 02:44 PM   #10
g4cli
LQ Newbie
 
Registered: Mar 2005
Distribution: Fedora Core 14
Posts: 14

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by smoker View Post
Ok, here's what I've discovered.

The Logitech C250 is supported by the Linux UVC driver.
So you need to establish if you have the driver installed. Please run
Code:
lsmod | grep uvcvideo
If you get a result, then the module is installed. If not then you need to get it and install it.
Instructions for building the module are here.
Hopefully you already have it installed, although Centos/RHEL 5.4 aren't up to the kernel version where it is installed by default. It may be on the system but not loaded into the kernel.
You can try running
Code:
locate uvcvideo
and see if that shows results somewhere under /lib/modules.
You may need to update the slocate database first :
As root -
Code:
updatedb
IF the module is there, but does not show up in lsmod output, then as root run -
Code:
modprobe uvcvideo
That same site also gives an example ffmpeg command, so if or when your output of lsmod is positive, try running this command
Code:
ffmpeg -f video4linux2 -s 320x240 -r 5 -i /dev/video0 -f m4v out.m4v
This will save the camera output as mpeg4 in a file called out.m4v
You will have to stop the recording manually, usually Ctrl+C.

If you get a readable file then all we have to do is use the ffserver settings from earlier in the thread to make use of this stream, and output the ffmpeg to a stream ffserver can use. Change the test.swf section in the /etc/ffserver.conf so that the VideoSize setting is 320x240

i.e.

Code:
ffmpeg -f video4linux2 -s 320x240 -r 5 -i /dev/video0 - http://127.0.0.1:8090/feed1.ffm
and
Code:
# /etc/ffserver.conf
# Port on which the server is listening. You must select a different
# port from your standard HTTP web server if it is running on the same
# computer.
Port 8090

# Address on which the server is bound. Only useful if you have
# several network interfaces.
BindAddress 0.0.0.0

# Number of simultaneous HTTP connections that can be handled. It has
# to be defined *before* the MaxClients parameter, since it defines the
# MaxClients maximum limit.
MaxHTTPConnections 2000

# Number of simultaneous requests that can be handled. Since FFServer
# is very fast, it is more likely that you will want to leave this high
# and use MaxBandwidth, below.
MaxClients 1000

# This the maximum amount of kbit/sec that you are prepared to
# consume when streaming to clients.
MaxBandwidth 1000

# Access log file (uses standard Apache log file format)
# '-' is the standard output.
CustomLog -

# Suppress that if you want to launch ffserver as a daemon.
NoDaemon

<Feed feed1.ffm>
	File /tmp/feed1.ffm #when remarked, no file is beeing created and the stream keeps working!!
	FileMaxSize 200K
       # Only allow connections from localhost to the feed.
       ACL allow 127.0.0.1
</Feed>

# SWF output - great for testing
<Stream test.swf>
	# the source feed
	Feed feed1.ffm
	# the output stream format - SWF = flash
	Format swf
	# this must match the ffmpeg -r argument
	VideoFrameRate 5
	# another quality tweak
	VideoBitRate 320
	# quality ranges - 1-31 (1 = best, 31 = worst)
	VideoQMin 1
	VideoQMax 3
	VideoSize 320x240
	# wecams don't have audio
	NoAudio
</Stream>

# FLV output - good for streaming
<Stream test.flv>
	# the source feed
	Feed feed1.ffm
	# the output stream format - FLV = FLash Video
	Format flv
	VideoCodec flv
	# this must match the ffmpeg -r argument
	VideoFrameRate 5
	# another quality tweak
	VideoBitRate 320
	# quality ranges - 1-31 (1 = best, 31 = worst)
	VideoQMin 1
	VideoQMax 3
	VideoSize 320x240
	# wecams don't have audio
	NoAudio
</Stream>

<Stream stat.html>
	Format status
</Stream>

<Redirect index.html>
	# credits!
	URL http://ffmpeg.sourceforge.net/
</Redirect>
You need to make a web page with a flash object embedded in it that uses the ffserver output as a source.

Code:
<object width="320" height="240"><param name="movie" value="http://127.0.0.1:8090/test.swf">
<embed src="http://127.0.0.1:8090/test.swf" width="320" height="240">
</embed></object>
Now by running the following in a terminal, it should all work.

Code:
ffserver &
ffmpeg -f video4linux2 -s 320x240 -r 5 -i /dev/video0 - http://127.0.0.1:8090/feed1.ffm
try accessing the local web page you created that contains the swf object.
I began to try your latest suggestions.

Here's what I got:

[root@localhost ~]# lsmod | grep uvcvideo
uvcvideo 53833 1
compat_ioctl32 5569 1 uvcvideo
videodev 25793 2 uvcvideo
v4l1_compat 16069 2 uvcvideo,videodev
v4l2_common 24385 2 uvcvideo,videodev

[root@localhost ~]# locate uvcvideo
/lib/modules/2.6.18-128.1.10.el5/kernel/drivers/media/video/uvc/uvcvideo.ko
/lib/modules/2.6.18-128.1.10.el5.centos.plus/kernel/drivers/media/video/uvc/uvcvideo.ko
/lib/modules/2.6.18-128.1.10.el5.centos.plusxen/kernel/drivers/media/video/uvc/uvcvideo.ko
/lib/modules/2.6.18-128.1.14.el5/kernel/drivers/media/video/uvc/uvcvideo.ko
/lib/modules/2.6.18-128.1.14.el5xen/kernel/drivers/media/video/uvc/uvcvideo.ko
/lib/modules/2.6.18-164.el5/kernel/drivers/media/video/uvc/uvcvideo.ko
/lib/modules/2.6.18-164.el5xen/kernel/drivers/media/video/uvc/uvcvideo.ko
/sys/bus/usb/drivers/uvcvideo
/sys/bus/usb/drivers/uvcvideo/1-1:1.0
/sys/bus/usb/drivers/uvcvideo/1-1:1.1
/sys/bus/usb/drivers/uvcvideo/bind
/sys/bus/usb/drivers/uvcvideo/module
/sys/bus/usb/drivers/uvcvideo/new_id
/sys/bus/usb/drivers/uvcvideo/unbind
/sys/module/uvcvideo
/sys/module/uvcvideo/parameters
/sys/module/uvcvideo/refcnt
/sys/module/uvcvideo/sections
/sys/module/uvcvideo/srcversion
/sys/module/uvcvideo/version
/sys/module/uvcvideo/parameters/quirks
/sys/module/uvcvideo/parameters/trace
/sys/module/uvcvideo/sections/.altinstr_replacement
/sys/module/uvcvideo/sections/.altinstructions
/sys/module/uvcvideo/sections/.bss
/sys/module/uvcvideo/sections/.data
/sys/module/uvcvideo/sections/.exit.text
/sys/module/uvcvideo/sections/.gnu.linkonce.this_module
/sys/module/uvcvideo/sections/.init.text
/sys/module/uvcvideo/sections/.module_sig
/sys/module/uvcvideo/sections/.rodata
/sys/module/uvcvideo/sections/.rodata.str1.1
/sys/module/uvcvideo/sections/.smp_locks
/sys/module/uvcvideo/sections/.strtab
/sys/module/uvcvideo/sections/.symtab
/sys/module/uvcvideo/sections/.text
/sys/module/uvcvideo/sections/__param
/sys/module/uvcvideo/sections/__versions

[root@localhost ~]# ffmpeg -f video4linux2 -s 320x240 -r 5 -i /dev/video0 -f m4v out.m4v
FFmpeg version SVN-r23386, Copyright (c) 2000-2010 the FFmpeg developers
built on May 29 2010 19:12:32 with gcc 4.1.2 20080704 (Red Hat 4.1.2-46)
configuration:
libavutil 50.16. 0 / 50.16. 0
libavcodec 52.72. 0 / 52.72. 0
libavformat 52.67. 0 / 52.67. 0
libavdevice 52. 2. 0 / 52. 2. 0
libavfilter 1.20. 0 / 1.20. 0
libswscale 0.10. 0 / 0.10. 0
[video4linux2 @ 0x993d510]Cannot find a proper format for codec_id 0, pix_fmt -1.
/dev/video0: Input/output error

any ideas?
 
Old 06-06-2010, 03:17 PM   #11
smoker
Senior Member
 
Registered: Oct 2004
Distribution: Fedora Core 4, 12, 13, 14, 15, 17
Posts: 2,279

Rep: Reputation: 248Reputation: 248Reputation: 248
no, i'm not psychic.

Last edited by smoker; 06-06-2010 at 03:18 PM.
 
Old 06-06-2010, 03:52 PM   #12
g4cli
LQ Newbie
 
Registered: Mar 2005
Distribution: Fedora Core 14
Posts: 14

Original Poster
Rep: Reputation: 0
Wink

Quote:
Originally Posted by smoker View Post
no, i'm not psychic.
I didn't think for a moment that you were, but I'm
looking to try and solve the problem. You've been
a marvelous help so far, and I just wondered if you
had any suggestions of what to try. Remember - I'm
a complete newbie, which obviously must be irritating
for you, and I'm sorry for that. If you need any further
info, please let me know.

Regards and thanks for all you've done so far.

Dave
 
  


Reply

Tags
apache, v4l, video


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ftp video files - cron job extracts video info & posts to web page? muskiediver Linux - General 6 11-23-2006 08:41 AM
Usb creative webcam live! ph2545 Linux - Newbie 1 04-02-2006 12:00 PM
Streaming Live Video using Webcam lkittinger Linux - Software 3 01-29-2006 01:56 PM
playing a video on web page matt_w_lambert Programming 1 11-19-2004 05:02 PM
How to capture live Video frames from webcam Madhukar Linux - General 0 04-14-2004 07:31 AM


All times are GMT -5. The time now is 11:25 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration