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 20 of 34 messages     [Show 3 7 14 *30* 100 999 days or 10 *20* 30 50 100 999 messages]

2009-10-17

by strick:

by strick:
http://www.gstreamer-winbuild.ylatuya.es/doku.php

For Python 2.5:

  • Pygst-0.10.15.1.exe

    It warns C:/Python25 already exists. I say Continue.

  • 2009-10-19

    by strick:
    # /home/strick/repos/owlvc [strick@albus owlvc]$ python2.4 mux.py hub xyzzy

    root@uhura:/home/strick/owlvc# python2.5 mux.py poke xyzzy BAR 2 Xyz albus.yak.net 55

    GC Timeout: ('128.61.105.188', 9999)
    Recent Add: ('128.61.105.188', 55045)
    Repeat except ('128.61.105.188', 55045) consider ('128.61.105.188', 55045)
    [] [] [] [] [] [] [] [] [] ['#70370'] ## RecvFrom:#70370 : ('128.61.105.188', 55045) -> ['0x3', '0x41', '0x62', '0x63', '0x4a', '0xdb', '0xe5', '0x35', '0x1', '0x0', '0x0', '0x66', '0x0', '0x0', '0x0', '0x3', '0x46', '0x4f', '0x4f', '0xb4', '0xd5', '0x4c', '0xd5']
    Repeat except ('128.61.105.188', 55045) consider ('128.61.105.188', 55045)
    [] [] ['#70370'] ## RecvFrom:#70370 : ('128.61.105.188', 9999) -> ['0x3', '0x58', '0x79', '0x7a', '0x4a', '0xdb', '0xe5', '0x38', '0x2', '0x0', '0x0', '0x66', '0x0', '0x0', '0x0', '0x3', '0x42', '0x41', '0x52', '0xdc', '0xad', '0x3', '0x60']
    Recent Add: ('128.61.105.188', 9999)
    Repeat except ('128.61.105.188', 9999) consider ('128.61.105.188', 9999)
    Repeat except ('128.61.105.188', 9999) consider ('128.61.105.188', 55045)
    ## SendTo:#70370 -> ('128.61.105.188', 55045) : ['0x2', '0x58', '0x79', '0x7a', '0x4a', '0xdb', '0xe5', '0x38', '0x2', '0x0', '0x0', '0x66', '0x0', '0x0', '0x0', '0x3', '0x42', '0x41', '0x52', '0xdc', '0xad', '0x3', '0x60']
    [] [] [] [] []
    
    

    strick@PC ~/work/owlvc
    $ python25 mux.py  poke xyzzy FOO 1 Abc albus.yak.net 555
    ## SendTo:#23403 -> ('albus.yak.net', 555) : ['0x3', '0x41', '0x62', '0x63', '
    0x4a', '0xdb', '0xe5', '0x35', '0x1', '0x0', '0x0', '0x66', '0x0', '0x0', '0x0',
     '0x3', '0x46', '0x4f', '0x4f', '0xb4', '0xd5', '0x4c', '0xd5']
    

    [strick@albus owlvc]$ rsync -ave 'ssh -vp22' ../owlvc/ strick@172.24.40.135:owlvc/

    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

    2010-11-08

    by strick:
    ffmpeg Example: Convert to mp4

    ffmpeg -acodec copy -b 820000 -i 22\ Things\ In\ My\ Pants.flv ffmpeg_820_22\ Things\ In\ My\ Pants.flv.mp4

    by strick:
    mencoder example -- I think using mp3 was a mistake.

    for x; do echo $x ; mencoder -ovc x264 -oac mp3lame "$x" -o "mencode_$x.mp4" ; done

    by strick:

    2010-11-10

    by strick:

    2011-09-04

    by strick:

    $ cat /usr/local/bin/a

    #!/bin/bash
    cd $HOME/Downloads
    
    DIR="$1"
    mkdir -p "$DIR"
    
    case $# in
    1)
      ls *.mp4 *.flv *.mp4.crdownload *.flv.crdownload *.mp4.part *.flv.part 2>/dev/null |
      while read f ; do
        test -f "$f" && test -s "$f" || continue
        case "$f" in
          *.crdownload )
            g=$(basename "$f" .crdownload)
            test -f ",$g," && continue
            bash "$0" "$DIR" "$f" &
            echo ::::: $! ::::: "$DIR" ::::: "$f" >&2
    	;;
          *.part )
            g=$(basename "$f" .part)
            test -f ",$g," && continue
            bash "$0" "$DIR" "$f" &
            echo ::::: $! ::::: "$DIR" ::::: "$f" >&2
    	;;
          * )
            mv -v "$f" "$DIR"
    	;;
        esac
      done
      ;;
    2)
      f="$2"
      g=$(basename "$f" .crdownload)
      g=$(basename "$g" .part)
      ln "$f" ",$g,"
      while true ; do
        if test -f "$g" && test -s "$g"; then
            echo "   $$ @@@" >&2
            mv -v "$g" "$DIR"
    	rm ",$g,"
    	break
        fi
        sleep 1
      done
      ;;
    *)
      echo WTF: $* >&2
      exit 13
      ;;
    esac
    
    
    

    by strick:
    Foo

    by strick:
    Remark this is a function. Come into this is a function. New line This is a function. Carriage return B**** make me a function. B**** define class camel virtual database proxy extending object. B**** import built in operating system. Declare of thirst rick at the yac Let routing end of file become negative 1. Lets shout ing in the file.

    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
  • (unless otherwise marked) Copyright 2002-2014 YakPeople. All rights reserved.
    (last modified 2010-01-20)       [Login]
    (No back references.)