Video capture VirtualBox from command line

Start and then stop VirtualBox screen recording from command line for a headless Windows 10 session running in virtual machine named Win10:

  • VBoxManage controlvm Win10 videocap on
  • VBoxManage controlvm Win10 videocap off
Advertisements

Can’t compile motion with RTSP on Raspberry Pi

You want to compile motion with RTSP support on Raspberry Pi, but you can’t.

.configure gives you this message:

**********************************************
* libavcodec.a or libavcodec.so or *
* libavformat.a or libavformat.so not found: *
* ALL FFMPEG FEATURES DISABLED *
* *
* Please read the Motion Guide for help: *
* http://motion.sourceforge.net *
**********************************************

Which means that  while motion will build, it will be lacking the RTSP support.

Possible reason:

Files do exist, but ./configure just doesn’t find them.

Solution:

Go to /usr/lib/arm-linux-gnueabihf.

See if there exist the aforementioned files.

If they don’t you need to install extra packages:

  • apt-get install libavformat-dev libavconv-dev libjpeg-dev

If they do, manually soft-link them into /usr/lib and run ./configure again.

If that was the problem, you will see a different message:

checking for ffmpeg autodetecting libraries... found in /usr/lib
checking for ffmpeg headers in /usr... found /usr/include/libavformat/avformat.h

Port forwarding for SONY IPELA with MikroTik

Say, we have SONY IPELA video conference system sitting at 192.168.101.2 right after our MikroTik router. We want to do the port forwarding so that people from outside can call us.

Quick and dirty solution:

  • /ip firewall nat add action=dst-nat chain=dstnat disabled=no dst-port=1720-1720 in-interface=ether1-gateway protocol=tcp to-addresses=192.168.101.2 to-ports=1720-1720 place-before=0
  • /ip firewall nat add action=dst-nat chain=dstnat disabled=no dst-port=2253-2255 in-interface=ether1-gateway protocol=tcp to-addresses=192.168.101.2 to-ports=2253-2255 place-before=0
  • /ip firewall nat add action=dst-nat chain=dstnat disabled=no dst-port=49152-49159 in-interface=ether1-gateway protocol=udp to-addresses=192.168.101.2 to-ports=49152-49159 place-before=0

See more on SONY IPELA port numbers here.


Port numbers used by SONY IPELA PCS-PG50

So you have your SONY IPELA PCS-G50 (or PCS-G70 for that matter) video conference system.
It sits in your LAN. System configuration is the simpliest default setup for point-to-point connection.
You want to make it available to the outside world to be able to receive incoming calls.

You have to set up port forwarding in your router for this to happen. What ports should you forward?

You can do it in the simpliest of ways by defining three ranges of ports to be forwarded to IPELA’s IP address for both TCP and UDP protocols:
Range Protocol
1720-1720 Both
2253-2255 Both
49152-49159 Both

Here are some details from manuals in case you are interested:

TCP:
RAS (PCS-G50/G50P) – Any number from 2253 to 2255
Q.931 (dial) – Any number from 2253 to 2255
Q.931 (answer) – 1720
H.245 – Any number from 2253 to 2255

UDP:
Audio RTP – 49152
Audio RTCP – 49153
Video RTP – 49154
Video RTCP – 49155
FECC RTP – 49156
FECC RTCP – 49157
Data conference/RTP – 49158
Data conference/RTCP – 49159


Saving dynamic streaming video

  • Install command line PHP interpreter and php5-curl, if you don’t already have them
    • sudo apt-get install php5-cli
    • sudo apt-get install php5-curl
  • Add HDS Link Detector add-on to your Firefox
  • Get AdobeHDS.php script
  • (Optional) Read some on what it is all about
  • In Firefox click on the grey HDS Link Detector icon so that it becomes red (i.e. enable it)
  • Go to the page which contains your dynamic streaming video
  • Wait for a long and cryptic message to pop up at the HDS Link Detector icon, then click on it to copy it to clipboard
  • Start a terminal window in directory where the AdobeHDS.php script is
  • Paste into the window the long and cryptic message which you copied and run it as command
  • Enjoy!

 


Record from webcam

You can use guvcview to record from webcam.


Bash script to play .m4v video and .ul audio together

So you have a lot of .m4v video files and a lot of .ul audio files with the same names. That, for example, might be a collection of  CCTV records, where the name of the file is the date and time of when the record was made. Now you would like to play them.

Create a bash script file in ~/bin, /usr/bin or similar directory. Paste the code inside. Add execution rights. Then run the script with .m4v video  file name as the only argument. The script will figure out name of the audio file on its own and afterwards it will play it all with a bunch of various parameters.

Let’s call it playit:

#!/bin/bash
 videoFile=$1
 audioFile="${videoFile%.*}.ul"
 mplayer -fps 25 -vf denoise3d=0:0:100:0 -cache 16000 -framedrop $videoFile -audiofile $audioFile -audio-demuxer rawaudio -rawaudio format=0x0007:channels=1:rate=8000

Later you can play all video files in the current directory with their accompanying audio files by means of another script, let’s call this one playall:

#!/bin/bash
 for i in *.m4v; do
    playit $i
 done

And another improvement. A script to look into all subdirectories of the current directory and play media found there. Useful if you have your packs of audio &  video files stored in timestamped directories. Let’s call this one playdirs:

#!/bin/bash
rootDir=$(pwd)
for subDir in */; do
cd $subDir
playall
cd $rootDir
done

And then yet another one. Play only files only in a single directory. That will be playdir:

#!/bin/bash
 subDir=$1
 rootDir=$(pwd)
 cd $subDir
 playall
 cd $rootDir