YaK:: The Yak tries Linux Webcam Video [Changes]   [Calendar]   [Search]   [Index]   [PhotoTags]   
[mega_changes]
[photos]

The Yak tries Linux Webcam Video

The story so far:

Using Ubuntu Desktop 8.02 (Hardy Heron), a little Logitech pokéball-shaped webcam is automatically recognized by the kernel.

With System > Administration > Synaptic Package Manager, we search for "webcam" and find "camorama".

Install it, and run "camorama" at the command line. It just works.

...

What we want:

A videoconference server and client screen, for multiple people to connect to.

Jan 2, 2009

ffmpeg commands http://docs.blackfin.uclinux.org/doku.php?id=uclinux-dist:ffmpeg

Records cam video to avi

ffmpeg -r 20 -f video4linux2 -s 352x288 -i /dev/video0 -an -f avi ./test.avi

Streams to a player at 192.169.9.107 listening on port 1234

ffmpeg -f video4linux2 -s cif -r 15 -i /dev/video0 -v 0 -vcodec mpeg4 -f mpegts udp:192.168.9.107:1234

ffserver sample config file: http://www.ffmpeg.org/sample.html

ubuntu webcam through ffserver and ffmpeg example: http://ubuntuforums.org/archive/index.php/t-665607.html

10062 ? S 0:01 gedit file:///home/strick/build/ffmpegTest/ffserverEx2.conf

10109 pts/1 S+ 0:04 ffserver -d -f ffserverEx2.conf

10120 pts/3 S+ 0:55 ffmpeg -r 15 -s 352x288 -f video4linux2 -i /dev/video0 http://localhost:8090/feed1.ffm

Port 8090
# bind to all IPs aliased or not
BindAddress 0.0.0.0
# max number of simultaneous clients
MaxClients 1000
# max bandwidth per-client (kb/s)
MaxBandwidth 10000
# Suppress that if you want to launch ffserver as a daemon.
NoDaemon

<Feed feed1.ffm>
File /tmp/feed1.ffm
FileMaxSize 5M
</Feed>

# ASF output - for windows media player
<Stream test.mpg>
# the source feed
Feed feed1.ffm
# the output stream format - ASF
Format mpegts
VideoCodec mpeg4
# this must match the ffmpeg -r argument
VideoFrameRate 15
# generally leave this is a large number
VideoBufferSize 80000
# another quality tweak
VideoBitRate 200
# quality ranges - 1-31 (1 = best, 31 = worst)
VideoQMin 1
VideoQMax 5
VideoSize 352x288
# this sets how many seconds in past to start
PreRoll 0
# wecams don't have audio
Noaudio
</Stream>

combines video: ffmpeg -i test1.avi -i test2.avi -vcodec copy -vcodec copy test12.avi -newvideo

gstreamer test: gst-launch-0.10 videotestsrc \! autovideosink

gstreamer + commandline toys: http://noraisin.net/~jan/diary/?p=40

More Working Stuff:

gst-launch-0.10 v4l2src ! video/x-raw-yuv,width=320,height=240 ! ffmpegcolorspace ! xvimagesink

gst-launch-0.10 -v -vv v4l2src ! queue ! video/x-raw-yuv,width=320,height=240,framerate="(fraction)10/1" ! queue ! videorate ! videoscale ! ffmpegcolorspace ! xvimagesink

Sender: might be working: but not with receiver?

gst-launch-0.10 -v -vv v4l2src ! queue ! video/x-raw-yuv,width=320,height=240,framerate="(fraction)10/1" ! queue ! videorate ! videoscale ! ffmpegcolorspace ! queue ! tcpserversink host=192.168.9.106 port=5555

OLPC on GStreamer: http://wiki.laptop.org/go/GStreamer

~ Saturday Jan 11, 2009 - Found out Uhura was using an old version of Ubuntu. Upgraded it to the latest version and Video LAN Client works in capturing video now. VLC 0.9.x uses Video4Linux2 which has better support for webcams.
~Ryan

~ I think VLC interfaces or bindings are the way to go. http://wiki.videolan.org/Interface VLC already works to stream and capture, we can build a new interface for it, tuned to our needs. See "Build an application on VLC" here: http://wiki.videolan.org/Developers_Corner
~Ryan




MORE NOTES

showing 10 of 27 messages     [Show 3 7 *10* 14 30 100 999 days or *10* 30 50 100 999 messages]

2009-10-26

by strick:
This is "WinDump.exe udp" output, on Windows XP.

These are fragmented UDP packets, typically 10K to 30K size. They leave the XP box successfully & arrive at 75-144-20-99 successfully. When 75-144-20-99 sends a packet back, it looks like only the first fragment (with the UDP header) makes it back.

Why not the other fragments?

The same kind of fragmented UDP do arrive back -- through the exact same routers & masquarade -- on a linux box on the same network, same switch, as this Windows box. So I think the problem has to be in XP.

20:56:03.008291 IP STRICK-CORP.mshome.net > 75-144-20-99-ca.sfba.comcastbusiness
.net: udp
20:56:03.008303 IP STRICK-CORP.mshome.net > 75-144-20-99-ca.sfba.comcastbusiness
.net: udp
20:56:03.063024 IP 75-144-20-99-ca.sfba.comcastbusiness.net.55055 > STRICK-CORP.
mshome.net.9899: UDP, length 14248
20:56:03.215487 IP STRICK-CORP.mshome.net.9899 > 75-144-20-99-ca.sfba.comcastbus
iness.net.55055: UDP, length 21334
20:56:03.215515 IP STRICK-CORP.mshome.net > 75-144-20-99-ca.sfba.comcastbusiness
.net: udp
20:56:03.215528 IP STRICK-CORP.mshome.net > 75-144-20-99-ca.sfba.comcastbusiness
.net: udp
20:56:03.215541 IP STRICK-CORP.mshome.net > 75-144-20-99-ca.sfba.comcastbusiness
.net: udp
20:56:03.215553 IP STRICK-CORP.mshome.net > 75-144-20-99-ca.sfba.comcastbusiness
.net: udp
20:56:03.215565 IP STRICK-CORP.mshome.net > 75-144-20-99-ca.sfba.comcastbusiness
.net: udp
20:56:03.215578 IP STRICK-CORP.mshome.net > 75-144-20-99-ca.sfba.comcastbusiness
.net: udp
20:56:03.215590 IP STRICK-CORP.mshome.net > 75-144-20-99-ca.sfba.comcastbusiness
.net: udp
20:56:03.215602 IP STRICK-CORP.mshome.net > 75-144-20-99-ca.sfba.comcastbusiness
.net: udp
20:56:03.215614 IP STRICK-CORP.mshome.net > 75-144-20-99-ca.sfba.comcastbusiness
.net: udp
20:56:03.215627 IP STRICK-CORP.mshome.net > 75-144-20-99-ca.sfba.comcastbusiness
.net: udp
20:56:03.215639 IP STRICK-CORP.mshome.net > 75-144-20-99-ca.sfba.comcastbusiness
.net: udp
20:56:03.215652 IP STRICK-CORP.mshome.net > 75-144-20-99-ca.sfba.comcastbusiness
.net: udp
20:56:03.215663 IP STRICK-CORP.mshome.net > 75-144-20-99-ca.sfba.comcastbusiness
.net: udp
20:56:03.215675 IP STRICK-CORP.mshome.net > 75-144-20-99-ca.sfba.comcastbusiness
.net: udp
20:56:03.262692 IP 75-144-20-99-ca.sfba.comcastbusiness.net.55055 > STRICK-CORP.
mshome.net.9899: UDP, length 13950
20:56:03.426976 IP STRICK-CORP.mshome.net.9899 > 75-144-20-99-ca.sfba.comcastbus
iness.net.55055: UDP, length 21288
20:56:03.427005 IP STRICK-CORP.mshome.net > 75-144-20-99-ca.sfba.comcastbusiness
.net: udp
20:56:03.427018 IP STRICK-CORP.mshome.net > 75-144-20-99-ca.sfba.comcastbusiness
.net: udp
20:56:03.427030 IP STRICK-CORP.mshome.net > 75-144-20-99-ca.sfba.comcastbusiness
.net: udp
20:56:03.427043 IP STRICK-CORP.mshome.net > 75-144-20-99-ca.sfba.comcastbusiness
.net: udp
20:56:03.427055 IP STRICK-CORP.mshome.net > 75-144-20-99-ca.sfba.comcastbusiness
.net: udp
20:56:03.427067 IP STRICK-CORP.mshome.net > 75-144-20-99-ca.sfba.comcastbusiness
.net: udp
20:56:03.427080 IP STRICK-CORP.mshome.net > 75-144-20-99-ca.sfba.comcastbusiness
.net: udp
20:56:03.427092 IP STRICK-CORP.mshome.net > 75-144-20-99-ca.sfba.comcastbusiness
.net: udp
20:56:03.427104 IP STRICK-CORP.mshome.net > 75-144-20-99-ca.sfba.comcastbusiness
.net: udp
20:56:03.427116 IP STRICK-CORP.mshome.net > 75-144-20-99-ca.sfba.comcastbusiness
.net: udp
20:56:03.427128 IP STRICK-CORP.mshome.net > 75-144-20-99-ca.sfba.comcastbusiness
.net: udp
20:56:03.427140 IP STRICK-CORP.mshome.net > 75-144-20-99-ca.sfba.comcastbusiness
.net: udp
20:56:03.427152 IP STRICK-CORP.mshome.net > 75-144-20-99-ca.sfba.comcastbusiness
.net: udp
20:56:03.427164 IP STRICK-CORP.mshome.net > 75-144-20-99-ca.sfba.comcastbusiness
.net: udp
20:56:03.463705 IP 75-144-20-99-ca.sfba.comcastbusiness.net.55055 > STRICK-CORP.
mshome.net.9899: UDP, length 14300

2010-01-04

by strick:
144a145,147
>     self.button = gtk.Button()
>     self.button.set_label("Push To Talk");
>     labels_vbox.pack_start(self.button)

2010-01-06

by strick:
Measuring SMOKE bytes per 30 seconds:

gst-launch-0.10 -v -v -m v4l2src ! "video/x-raw-yuv,width=640,height=480,framerate=(fraction)5/1" ! ffmpegcolorspace ! smokeenc keyframe=64 ! identity dump=0 ! smokedec ! xvimagesink sync=false | tr '(),' ' ' | awk '$6="identity0:sink" && $9=="bytes" {b+=$8; print b}'

gst-launch-0.10 -v -v -m v4l2src ! "video/x-raw-yuv,width=320,height=240,framerate=(fraction)5/1" ! ffmpegcolorspace ! smokeenc keyframe=64 ! identity dump=0 ! smokedec ! xvimagesink sync=false | tr '(),' ' ' | awk '$6="identity0:sink" && $9=="bytes" {b+=$8; print b}'

Works well:

gst-launch-0.10 -v -v -m v4l2src ! "video/x-raw-yuv,width=320,height=240,framerate=(fraction)5/1" ! ffmpegcolorspace ! theoraenc ! rtptheorapay ! identity dump=0 ! rtptheoradepay ! theoradec ! xvimagesink sync=false

But freezes up very often with drop-probability=0.1:

gst-launch-0.10 -v -v -m v4l2src ! "video/x-raw-yuv,width=320,height=240,framerate=(fraction)5/1" ! ffmpegcolorspace ! theoraenc ! rtptheorapay ! identity dump=0 drop-probability=0.1 ! rtptheoradepay ! theoradec ! xvimagesink sync=false

Much more usable with "theoraenc keyframe-force=5".

Totalling bytes (this time, kf-f=10):

gst-launch-0.10 -v -v -m v4l2src ! "video/x-raw-yuv,width=320,height=240,framerate=(fraction)5/1" ! ffmpegcolorspace ! theoraenc keyframe-force=10 ! rtptheorapay ! identity dump=0 drop-probability=0.0 ! rtptheoradepay ! theoradec ! xvimagesink sync=false | tr '(),' ' ' | awk '$6="identity0:sink" && $9=="bytes" {b+=$8; print b}'

Me sitting at camera, moving some, still some, for 30sec from launch to closing xvimage, calculating kilobits per second:

\n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n \n\n
30sec 320x240x5/1 smoke keyframe=64 630K bytes 168 kbps
30sec 320x240x5/1 theora keyframe-force=5 300K bytes 80 kbps
30sec 320x240x5/1 theora keyframe-force=10 200K bytes 53 kbps
30sec 320x240x5/1 theora keyframe-force=64 175K bytes 47 kbps

30sec 640x480x5/1 smoke keyframe=64 1635K bytes 436 kbps
30sec 640x480x5/1 theora keyframe-force=5 750K bytes 200 kbps
30sec 640x480x5/1 theora keyframe-force=10 600K bytes 160 kbps
30sec 640x480x5/1 theora keyframe-force=64 520K bytes 139 kbps

By copying and pasting the capability, I can use a udpsink-udpsrc pipeline. Both sides seem to be able to stop & restart smoothly:

  • theora-640x480x5.sh

    So how can I capture those capabilities with Python, and make them available out-of-band?

  • 2010-01-12

    by strick:
    HOWTO RUN OLD (smoke, mulaw) OWLVC:

    1. Run a hub on a host & port visible to all participants.

    OWL_HUB_HOST=192.168.1.242 OWL_HUB_PORT=1234 OWL_PW=secret python mux.py hub

    2. On each client, run the media pipelines:

    sh med.sh

    3. On each client, run the mux:

    OWL_HUB_HOST=192.168.1.242 OWL_HUB_PORT=1234 OWL_PW=secret python mux.py mux WHO

    The final parameter "WHO" is a unique 3 letters for each user.

    This does not work on OSX, where UDP packets bigger than the ethernet MTU are broken on loopback net.

    by strick:
    HOWTO RUN THE NEW (theora, vorbis) OWLVC (doesn't quite work yet):

    1. Run a HUB and a WHAT server, on a machine visible to all clients, with port 8212 visible in both TCP & UDP:

    python newhub.py

    python what-server.py

    2. On each client, run the combined media & mux:

    python launch-media.py hub=hostname:8212

    Doesn't quite work yet.

    by strick:
    DARCS repository for OWLVC:

    http://gluon.yak.net/repos/owlvc/

    2010-01-14

    by strick:
    # Highly Pixelating

    gst-launch-0.10 -vm v4l2src ! ffmpegcolorspace ! videoscale ! video/x-raw-yuv,width=40,height=30 ! videoscale ! video/x-raw-yuv,width=800,height=600 ! ffmpegcolorspace ! xvimagesink

    2010-01-15

    by strick:

    2010-01-18

    by strick:

    2010-01-24

    by strick:
    WHITEPAPER – IP Streaming of MPEG-4: Native RTP vs MPEG-2 TS http://www.envivio.com/pdf/RTPvsTS-v4.pdf

    Post a new message:

       

    Cache

  • udp.py
  • udp.py
  • client4.py
  • both.sh
  • lx-send.txt
  • lx-recv.txt
  • win-recv.txt
  • win-send.txt
  • multi-vid.sh
  • pygst-webcam-viewer.py
  • both-lx.sh
  • Copyright 2002-2006 YakPeople. All rights reserved.
    (last modified 2010-01-20)       [Login]
    (No back references.)