Analog video input for Virtualrilka and its application in the national economy
KDPV
Nowadays, the ubiquitous dominance of very compact, economical and multi-megapixel digital video sensors, the good old analog CCD camcorders are slowly being forgotten, remaining in demand only where the advantages of CCD matrices over CMOS are required. This is the automotive industry (rear view cameras), and video surveillance, and various professional equipment (for example, thermal imagers). In general, where high sensitivity in low light and a decent dynamic range are required. But even in these areas, cameras with CMOS sensors are gradually replacing the “tsezedoshki”.
But there remains a large number of old analog cameras and I want to somehow use them in a new way. And if you recall that many interesting devices have an analogue (composite, with RCA connectors, also known as a “tulip”) output, I really wanted to capture a video stream from them for subsequent transmission via digital communication channels. Of course, for these purposes, you can use a USB TV tuner or more or less specialized USB devices with a composite input, but this option is quite cumbersome, and not all ARM controllers can take advantage of hardware-based video encoding for USB sources.
In general, to solve some problems, it was required to connect a device producing exactly analog video signal to our Virtrilka. We (or rather, our apprentice Sasha) searched the Internet and found a suitable chip - Texas Instruments TVP5150AM1 . It has two inputs for composite video, but they can work in turns, not simultaneously. The chip generates 720x576 @ 50fps on a parallel bus, through which we usually connect our digital camera sensor to the Virtualrilka.
An analog video stream after capture is interlaced, unlike the usual progressive one, so the video stream formed by the chip needs to be subjected to deinterlacing. This is done by DSP Virtualrilki. Moreover, there are several options for deinterlacing; they are set at the kernel driver level. While we tried only one option, it suits everyone so that they did not pick it further. Also, we have not tested the NTSC mode, in which the video resolution is 640x480 pixels. The chip supports this mode without problems, but switching has not yet been implemented in the driver, now it works only in PAL.
In general, picking a driver was the biggest problem when developing an analog input board. Initially, PAL video worked only 640x480, the edges were cropped from the original frame. The problem was solved by one of the early board testers, who found an error and stuck a patch that fixed the problem. It turned out that a resolution of 640x480 was hardcoded in the video subsystem. :-)
In general, meet - a board for capturing an analog video signal:
http://wiki.virt2real.ru/wiki/Analog_TVP51__module
Size 37x29 mm (excluding protruding connectors).
Connecting the board is similar to connecting a camera module - just plug in the cable and snap the latch. :-) When put on, it looks something like this:
To work with this module, you need to use a special kernel, the sources of which are located on our Github in the TVP5150 brunch .
Of course, few people will build the kernel themselves, so for most, a ready-made fresh firmware for Virtualrilka is suitable, where there are already kernels for our ordinary digital camera and there is a kernel for the analog module. True, there is also a core for the HDMI input, but these cards are worth their weight in gold, so we are not letting them into the store yet. :-)
Link to the firmware http://files.virt2real.ru/firmware/virt2real-board/1.1/virt2real-1.02.002.zip
By default, the HD core is active in the firmware for a digital camera, so for use with an analog module, you need to switch the kernel. This is done by simply copying the uImage.tvp5150 file to the uImage file in the boot section, but it is much more convenient to do this in the admin panel. Section "Settings -> Kernels". Select "uImage.tvp5150", click the "Save" button, rebuild the piece of iron and get the active kernel for the TVP5150.
By the way, in the same place, in the admin panel, you can immediately check the video broadcast from the analog input. To do this, in the "Video" section there are many options for transmitting video (you can broadcast in RTP, RTSP, RTMP and on Ivideon).
As I said, the video input is double, i.e. You can connect two independent composite video sources and switch them as needed. Switching consists in changing the state of one register i2c of the device and comes down to the commands
Select the first input:
Select second input:
The same can be done with the mouse in the admin panel, in the "Cameras -> TVP5150" section there are two buttons, "Input 1" and "Input 2", when clicked, the above commands are executed.
Since most devices with an analog output have a linear audio output (usually a white tulip next to yellow, or white + red for stereo), you can also bring sound to Virtrilka. She has a microphone input, which, in combination, is also a linear audio input.
When using gstreamer for broadcasting, you must specify the correct video format settings, as there is one small nuance - the pitch parameter is required; without it, the picture will be distorted.
Here is an example of transferring video from an analog input via RTP:
For all video broadcast scripts used in the standard firmware, all the main video parameters are saved in the settings file when changing the current kernel. This was done so that each time you do not rule the chain with your hands. A trifle, but very convenient.
The most interesting part of my story, IMHO. Abstractly, nobody needs a piece of iron; its application for specific purposes is needed.
The first thing I did when I got a test copy of the analog module was to attach it to a six-wheeled cart. A Canon 60D DSLR camera and a conventional analog camcorder with a CCD sensor from SONY were installed on the cart. Sonya acted as a course camera, i.e. From the picture from it, I remotely controlled the cart. A DSLR acted as a photographer - in the managing application Virt2real Playerwhen a special button was pressed, the video input was switched, and the second button was responsible for releasing the shutter on the DSLR. Thus, it was possible to ride with a view through one camera, and before photographing, switch to a DSLR, aim and focus on the desired object and take a picture. Unfortunately, the Canon 60D is not able to simultaneously send video to the analog video output (and on hdmi too, I already checked it) and allow it to be controlled via PTP. It’s a pity, since PTP DSLR control has long been mastered, even in our admin panel there is a corresponding module, you can change any shooting settings on the fly.
In general, this trolley was tested at the Open Innovations 2014 exhibition. A squirrel from the Ice Age was mounted on the cart for greater mimicry and, accordingly, to attract the attention of a female. The mirror was pulled up, and the trolley received the code name "Petticoat". Guess why.
The ride looked something like this
Short skirts were few, so the catch came out sparse. Only two frames were excellent, but I won’t publish them in order to keep up appearances. I will show you only one innocent shot from the "Hyloid":
I still can’t reach this option for installing at a permanent location, and it rolls around for use as debugging. The bottom line is simple: there is a video peephole (CCD, of course) in the door to the landing, it’s just that you can’t install a virtual rifle with a digital camera, you need a peephole in the form of a regular glass door peephole. A video cable comes with a standard cable, two wires and a screen. In one core there is 12V power, in another there is a video signal from the eye, the screen, respectively, is common ground. Video from the peephole is simultaneously recorded on the Virtualrilka flash drive, plus it is displayed on the monitor at the front door of my apartment. Memo to myself: it would be necessary to do a cyclical recording, otherwise it will be revelry.
Well, of course, the video is duplicated over the network to any connected device (regular computer, device for iOS or device for Android).
Now I have it disassembled, so the illustration is not very clear. On the monitor you can see the picture from the goprohi:
In general, the whole business has yet to be ennobled and yet to establish all this, finally, in a permanent place at the door.
Somehow they gave me a real thermal imager for rent, from Flir (I could not determine the exact model). At first I planned to install it on a cart as a second camera (instead of a mirror), but I got carried away examining my plastic windows for freezing and forgot about the cart completely.
With a thermal imager, everything is simple - we connect its analog output to our entrance, turn on the broadcast and go around the apartment, we look where the windows are poorly insulated. Well, do not forget to take a picture of ourselves in the IR range.
Of course, you can transmit video from a thermal imager with a conventional RC-shn video transmitter, but this turns out to be a more cumbersome option. It’s more convenient to stream directly from the Virtualka to the grid to watch it on a smartphone or tablet.
Actually, this is a special case of how a DSLR was used on a trolley. Rilttime video transmission from the viewfinder. Video encoded in H264 with the desired bitrate for transmission over relatively narrow channels (3G / 4G). If the model of the photographic unit supports simultaneous video output and control via PTP - then it’s just beauty, you can also change any parameters (shutter speed, aperture, focus points, etc.). My Canon 60D does not support this, unfortunately. Either control or video. True, with PTP it is possible to receive video from the viewfinder, but it is of low resolution in the MJPEG format, and this is usually unsuitable for transferring somewhere.
When I served in the army (communication platoon), I had to mess around a lot with a pretty cool video surveillance system called VideoNet. So, of course, I tried to make friends with her Virtualrilka. They made friends easily - it’s enough to start the RTSP server on Virtualrilka (you can from the admin panel), and add a “Universal RTSP” type camera to the VideoNet. Of course, here it is not necessary to use an analog input, but with it personally I am more interested.
The video source is GoPro connected to our analog video input.
Probably, all readers of Habr know about a cool company called Ivideon . They often poke around with cameras based on the DM368 processor (and yes, DM365, I think), so they met us - they gave us their client to connect to their cloud. As a result, a module appeared in the admin panel for binding Virtualrilki to the Ivideon service and the ability to broadcast video to it. The admin module wrote hastily, I confess, it turned out clumsy, but it still works.
The same source acts as a video source:
I would still need the guys from Ivideon to ask the API for a motion detector and for the initial camera binding via QR code recognition through the camera. :-)
Have many heard about Twitch ? I’m not a gamer at all, so I heard about him recently. Just on hand was a test sample of the analog input, so I thought - why not stream from the old console? In modern (PS, XBOX) broadcasts on Twitch are already in standard firmware (sort of like), but for old consoles this is not possible.
True, I don’t have a real Dendy (NES) or Sega for a long time, but there is Playstation2 for which I made a disk with an NES emulator a long time ago and sometimes we chop into daughters with my daughters. And how would I launch this on a twitch?
Bullshit question. We take ... Yes, all the same our Virtualrilka, a fresh analog module. We connect, open the section with RTMP broadcasts in the admin panel, enter the stream address (taken from the channel settings in your personal account on Twitch), something like
rtmp: //live-lhr.twitch.tv/app/live_73242159_p0OUfxtnBGoSwgdcaQVXZ7uRJOhs for, , see your game on the tweet!
Screenshot from my blog Video
demo of broadcasting the game Chip'n'Dale 2 to Twitch.tv service:
And if you connect the audio output to the microphone input of the Virtrilka, you can do this:
Of course, I managed to test only a small part of what can be done with the analog video output. Personally, I like it even more than the HDMI input and than ordinary digital cameras, because it is compatible with a bunch of any equipment.
When we first tweeted about the analog input, several response tweets at once were about connecting a full-time car rear-view camera in order to see a picture on an android device. I don’t have a parking camera in my car, so I can’t check it. And somehow I don’t want to screw the usual one to the bumper :-)
Another person was going to fasten the video output of the telescope to the virtual computer to stream to the Internet. Let's see what he gets in the end.
You can throw your use cases (if they are not secret, of course) into comments. What I can - I’ll quickly test and unsubscribe about the results. Well, or you can check interesting options yourself, the analog module is already on sale. If we see a very interesting application in the comments, we guarantee the author a prize analog input. Of course, only if he already has a Virtualrilka, otherwise the module has nothing to cling to. Well, and if the application is very, very, very interesting - we will give Virtualkylka in full ammunition as well.
We ourselves have already tied up selling devices to end consumers, so now all of our hardware is sold in the Chipster online store . And yes, you yourself know what is happening with the ruble exchange rate, so prices will have to be raised periodically, excuse me.
Not really about the analog module, but also useful for it. Just the day before yesterday as a result of a roof-top experiment, it turned out that Virtrilka, which is actually based on the DM365 processor, works perfectly at the frequencies of the older processor, DM368. I won’t copy-paste , I’ll give a link, if anyone is suddenly interested - http://www.g0l.ru/blog/n4018
In short - our DM365 feels great at frequencies of DM368 (CPU 432 Mhz, DDR 340 MHz). The network works, wifi works, video from cameras, from the analog input, from the HDMI input - everything works as it should. Only now it did not work out to check Full HD video, for lack of a suitable source. How to reconfigure the HDMI input to 1080p or get a sensor with Full HD - I’ll check if it can pull a topic.
The Virtualrilka dispersed in this way has been working continuously for more than 14 hours, the flight is stable. The increased frequency was very useful for HD RTMP broadcasts, where earlier than the usual frequency, 300 MHz was enough for a modest bitrate.
If anyone is interested to try - link to the firmware I
just warn you right away - while this is in the testing phase, I can’t guarantee anything. If the overclocked Virturilka explodes, swells, collapses, annihilates, Virt2real is not responsible for this. So, "You have been warned!", As they say.
To view RTP video streams on mobile devices, we released the first versions of applications:
Android
iOS
And for viewing on a desktop:
For Windows
Online store Chipster.ru
Background
Nowadays, the ubiquitous dominance of very compact, economical and multi-megapixel digital video sensors, the good old analog CCD camcorders are slowly being forgotten, remaining in demand only where the advantages of CCD matrices over CMOS are required. This is the automotive industry (rear view cameras), and video surveillance, and various professional equipment (for example, thermal imagers). In general, where high sensitivity in low light and a decent dynamic range are required. But even in these areas, cameras with CMOS sensors are gradually replacing the “tsezedoshki”.
But there remains a large number of old analog cameras and I want to somehow use them in a new way. And if you recall that many interesting devices have an analogue (composite, with RCA connectors, also known as a “tulip”) output, I really wanted to capture a video stream from them for subsequent transmission via digital communication channels. Of course, for these purposes, you can use a USB TV tuner or more or less specialized USB devices with a composite input, but this option is quite cumbersome, and not all ARM controllers can take advantage of hardware-based video encoding for USB sources.
Our piece of iron
In general, to solve some problems, it was required to connect a device producing exactly analog video signal to our Virtrilka. We (or rather, our apprentice Sasha) searched the Internet and found a suitable chip - Texas Instruments TVP5150AM1 . It has two inputs for composite video, but they can work in turns, not simultaneously. The chip generates 720x576 @ 50fps on a parallel bus, through which we usually connect our digital camera sensor to the Virtualrilka.
An analog video stream after capture is interlaced, unlike the usual progressive one, so the video stream formed by the chip needs to be subjected to deinterlacing. This is done by DSP Virtualrilki. Moreover, there are several options for deinterlacing; they are set at the kernel driver level. While we tried only one option, it suits everyone so that they did not pick it further. Also, we have not tested the NTSC mode, in which the video resolution is 640x480 pixels. The chip supports this mode without problems, but switching has not yet been implemented in the driver, now it works only in PAL.
In general, picking a driver was the biggest problem when developing an analog input board. Initially, PAL video worked only 640x480, the edges were cropped from the original frame. The problem was solved by one of the early board testers, who found an error and stuck a patch that fixed the problem. It turned out that a resolution of 640x480 was hardcoded in the video subsystem. :-)
In general, meet - a board for capturing an analog video signal:
http://wiki.virt2real.ru/wiki/Analog_TVP51__module
Size 37x29 mm (excluding protruding connectors).
Compared to the camera module
What does it eat
Connecting the board is similar to connecting a camera module - just plug in the cable and snap the latch. :-) When put on, it looks something like this:
To work with this module, you need to use a special kernel, the sources of which are located on our Github in the TVP5150 brunch .
Of course, few people will build the kernel themselves, so for most, a ready-made fresh firmware for Virtualrilka is suitable, where there are already kernels for our ordinary digital camera and there is a kernel for the analog module. True, there is also a core for the HDMI input, but these cards are worth their weight in gold, so we are not letting them into the store yet. :-)
Link to the firmware http://files.virt2real.ru/firmware/virt2real-board/1.1/virt2real-1.02.002.zip
By default, the HD core is active in the firmware for a digital camera, so for use with an analog module, you need to switch the kernel. This is done by simply copying the uImage.tvp5150 file to the uImage file in the boot section, but it is much more convenient to do this in the admin panel. Section "Settings -> Kernels". Select "uImage.tvp5150", click the "Save" button, rebuild the piece of iron and get the active kernel for the TVP5150.
By the way, in the same place, in the admin panel, you can immediately check the video broadcast from the analog input. To do this, in the "Video" section there are many options for transmitting video (you can broadcast in RTP, RTSP, RTMP and on Ivideon).
As I said, the video input is double, i.e. You can connect two independent composite video sources and switch them as needed. Switching consists in changing the state of one register i2c of the device and comes down to the commands
Select the first input:
i2cset -f -y 1 0x5d 0x00 0x00
Select second input:
i2cset -f -y 1 0x5d 0x00 0x02
The same can be done with the mouse in the admin panel, in the "Cameras -> TVP5150" section there are two buttons, "Input 1" and "Input 2", when clicked, the above commands are executed.
Since most devices with an analog output have a linear audio output (usually a white tulip next to yellow, or white + red for stereo), you can also bring sound to Virtrilka. She has a microphone input, which, in combination, is also a linear audio input.
When using gstreamer for broadcasting, you must specify the correct video format settings, as there is one small nuance - the pitch parameter is required; without it, the picture will be distorted.
Here is an example of transferring video from an analog input via RTP:
gst-launch v4l2src always-copy=false chain-ipipe=true ! \
capsfilter caps=video/x-raw-yuv,format='(fourcc)'NV12,width=720,height=576,framerate='(fraction)'25,pitch=736 ! \
dmaiaccel ! dmaienc_h264 copyOutput=false ddrbuf=false encodingpreset=2 ratecontrol=2 intraframeinterval=30 idrinterval=120 t8x8intra=true t8x8inter=true targetbitrate=$BITRATE bytestream=true headers=false ! \
rtph264pay mtu=1500 ! \
multiudpsink clients="192.168.1.10:3000" sync=false enable-last-buffer=false
For all video broadcast scripts used in the standard firmware, all the main video parameters are saved in the settings file when changing the current kernel. This was done so that each time you do not rule the chain with your hands. A trifle, but very convenient.
Where can this be used in business
The most interesting part of my story, IMHO. Abstractly, nobody needs a piece of iron; its application for specific purposes is needed.
Steered trolley
The first thing I did when I got a test copy of the analog module was to attach it to a six-wheeled cart. A Canon 60D DSLR camera and a conventional analog camcorder with a CCD sensor from SONY were installed on the cart. Sonya acted as a course camera, i.e. From the picture from it, I remotely controlled the cart. A DSLR acted as a photographer - in the managing application Virt2real Playerwhen a special button was pressed, the video input was switched, and the second button was responsible for releasing the shutter on the DSLR. Thus, it was possible to ride with a view through one camera, and before photographing, switch to a DSLR, aim and focus on the desired object and take a picture. Unfortunately, the Canon 60D is not able to simultaneously send video to the analog video output (and on hdmi too, I already checked it) and allow it to be controlled via PTP. It’s a pity, since PTP DSLR control has long been mastered, even in our admin panel there is a corresponding module, you can change any shooting settings on the fly.
In general, this trolley was tested at the Open Innovations 2014 exhibition. A squirrel from the Ice Age was mounted on the cart for greater mimicry and, accordingly, to attract the attention of a female. The mirror was pulled up, and the trolley received the code name "Petticoat". Guess why.
The ride looked something like this
Short skirts were few, so the catch came out sparse. Only two frames were excellent, but I won’t publish them in order to keep up appearances. I will show you only one innocent shot from the "Hyloid":
Video-eye
I still can’t reach this option for installing at a permanent location, and it rolls around for use as debugging. The bottom line is simple: there is a video peephole (CCD, of course) in the door to the landing, it’s just that you can’t install a virtual rifle with a digital camera, you need a peephole in the form of a regular glass door peephole. A video cable comes with a standard cable, two wires and a screen. In one core there is 12V power, in another there is a video signal from the eye, the screen, respectively, is common ground. Video from the peephole is simultaneously recorded on the Virtualrilka flash drive, plus it is displayed on the monitor at the front door of my apartment. Memo to myself: it would be necessary to do a cyclical recording, otherwise it will be revelry.
Well, of course, the video is duplicated over the network to any connected device (regular computer, device for iOS or device for Android).
Now I have it disassembled, so the illustration is not very clear. On the monitor you can see the picture from the goprohi:
And the script for different types of image duplication looks like this for now
CAPS=video/x-raw-yuv,format=\(fourcc\)NV12,width=720,height=576,pitch=736,framerate=\(fraction\)25/1
ENCODER="dmaienc_h264 encodingpreset=2 ratecontrol=2 targetbitrate=2000000 maxbitrate=2000000 intraframeinterval=25 idrinterval=500 bytestream=false headers=false aud=false level=51 t8x8intra=true t8x8inter=true airrate=30"
VIDEOOUT="TIDmaiVideoSink videoStd=D1_PAL videoOutput=composite accelFrameCopy=false noCopy=true sync=false max-lateness=300000000 render-delay=300000000"
REC="matroskamux streamable=true min-index-interval=1000000000 ! filesink location=video.mkv enable-last-buffer=false sync=true"
#REC="flvmux ! filesink location=video.flv enable-last-buffer=false sync=false"
#REC="mp4mux streamable=false dts-method=1 presentation-time=true ! filesink location=video.mp4 enable-last-buffer=false sync=false"
# clear overlay window
fbset -yres 0 -fb /dev/fb0
# show
type0 () {
gst-launch v4l2src always-copy=false chain-ipipe=true ! \
$CAPS !\
dmaiaccel !\
$VIDEOOUT
}
# show and send
type1 () {
gst-launch v4l2src always-copy=false chain-ipipe=true ! \
$CAPS !\
dmaiaccel !\
tee name=sendvideo !\
queue max-size-buffers=0 max-size-bytes=0 max-size-time=0 !\
$VIDEOOUT \
sendvideo. !\
$ENCODER !\
queue max-size-buffers=0 max-size-bytes=0 max-size-time=0 !\
rtph264pay !\
multiudpsink clients=192.168.1.10:3000 enable-last-buffer=false sync=false
}
# show, send and record
type2 () {
gst-launch v4l2src always-copy=false chain-ipipe=true ! \
$CAPS ! \
dmaiaccel ! \
tee name=sendvideo ! \
queue max-size-buffers=0 max-size-bytes=0 max-size-time=0 !\
$VIDEOOUT \
sendvideo. ! \
queue max-size-buffers=0 max-size-bytes=0 max-size-time=0 !\
$ENCODER ! \
tee name=recvideo ! \
queue max-size-buffers=0 max-size-bytes=0 max-size-time=0 !\
rtph264pay ! \
multiudpsink clients=192.168.1.10:3000 enable-last-buffer=false sync=false \
recvideo. ! \
queue max-size-buffers=0 max-size-bytes=0 max-size-time=0 !\
legacyh264parse config-interval=2 split-packetized=false output-format=2 access-unit=true ! \
$REC
}
# send and record
type3 () {
gst-launch v4l2src always-copy=false chain-ipipe=true ! \
$CAPS ! \
dmaiaccel ! \
dmaiperf print-arm-load=true ! \
queue max-size-buffers=0 max-size-bytes=0 max-size-time=0 !\
$ENCODER ! \
tee name=recvideo ! \
queue max-size-buffers=0 max-size-bytes=0 max-size-time=0 !\
rtph264pay ! \
multiudpsink clients=192.168.1.10:3000 enable-last-buffer=false sync=false \
recvideo. ! \
queue max-size-buffers=0 max-size-bytes=0 max-size-time=0 !\
legacyh264parse config-interval=2 split-packetized=false output-format=2 access-unit=true ! \
$REC
}
# show and record
type4 () {
gst-launch v4l2src always-copy=false chain-ipipe=true ! \
$CAPS ! \
dmaiaccel ! \
tee name=recvideo ! \
queue max-size-buffers=0 max-size-bytes=0 max-size-time=0 !\
$VIDEOOUT \
recvideo. ! \
queue max-size-buffers=0 max-size-bytes=0 max-size-time=0 !\
$ENCODER ! \
queue max-size-buffers=0 max-size-bytes=0 max-size-time=0 !\
legacyh264parse config-interval=2 split-packetized=false output-format=2 access-unit=true ! \
$REC
}
type0
Video with video eyeballs
In general, the whole business has yet to be ennobled and yet to establish all this, finally, in a permanent place at the door.
Thermal imager
Somehow they gave me a real thermal imager for rent, from Flir (I could not determine the exact model). At first I planned to install it on a cart as a second camera (instead of a mirror), but I got carried away examining my plastic windows for freezing and forgot about the cart completely.
With a thermal imager, everything is simple - we connect its analog output to our entrance, turn on the broadcast and go around the apartment, we look where the windows are poorly insulated. Well, do not forget to take a picture of ourselves in the IR range.
Video with windows
Of course, you can transmit video from a thermal imager with a conventional RC-shn video transmitter, but this turns out to be a more cumbersome option. It’s more convenient to stream directly from the Virtualka to the grid to watch it on a smartphone or tablet.
Live streaming from SLR
Actually, this is a special case of how a DSLR was used on a trolley. Rilttime video transmission from the viewfinder. Video encoded in H264 with the desired bitrate for transmission over relatively narrow channels (3G / 4G). If the model of the photographic unit supports simultaneous video output and control via PTP - then it’s just beauty, you can also change any parameters (shutter speed, aperture, focus points, etc.). My Canon 60D does not support this, unfortunately. Either control or video. True, with PTP it is possible to receive video from the viewfinder, but it is of low resolution in the MJPEG format, and this is usually unsuitable for transferring somewhere.
Video from the Canon 60D
Video Surveillance Using VideoNet
When I served in the army (communication platoon), I had to mess around a lot with a pretty cool video surveillance system called VideoNet. So, of course, I tried to make friends with her Virtualrilka. They made friends easily - it’s enough to start the RTSP server on Virtualrilka (you can from the admin panel), and add a “Universal RTSP” type camera to the VideoNet. Of course, here it is not necessary to use an analog input, but with it personally I am more interested.
The video source is GoPro connected to our analog video input.
Virtualrilka, analog video input and VideoNet
Video surveillance through Ivideon
Probably, all readers of Habr know about a cool company called Ivideon . They often poke around with cameras based on the DM368 processor (and yes, DM365, I think), so they met us - they gave us their client to connect to their cloud. As a result, a module appeared in the admin panel for binding Virtualrilki to the Ivideon service and the ability to broadcast video to it. The admin module wrote hastily, I confess, it turned out clumsy, but it still works.
The same source acts as a video source:
Virtualrilka, analog video input and Ivideon
I would still need the guys from Ivideon to ask the API for a motion detector and for the initial camera binding via QR code recognition through the camera. :-)
Streaming with old-school consoles
Have many heard about Twitch ? I’m not a gamer at all, so I heard about him recently. Just on hand was a test sample of the analog input, so I thought - why not stream from the old console? In modern (PS, XBOX) broadcasts on Twitch are already in standard firmware (sort of like), but for old consoles this is not possible.
True, I don’t have a real Dendy (NES) or Sega for a long time, but there is Playstation2 for which I made a disk with an NES emulator a long time ago and sometimes we chop into daughters with my daughters. And how would I launch this on a twitch?
Bullshit question. We take ... Yes, all the same our Virtualrilka, a fresh analog module. We connect, open the section with RTMP broadcasts in the admin panel, enter the stream address (taken from the channel settings in your personal account on Twitch), something like
rtmp: //live-lhr.twitch.tv/app/live_73242159_p0OUfxtnBGoSwgdcaQVXZ7uRJOhs for, , see your game on the tweet!
Screenshot from my blog Video
demo of broadcasting the game Chip'n'Dale 2 to Twitch.tv service:
Script to broadcast on Twitch without sound
gst-launch v4l2src always-copy=false chain-ipipe=true ! \
capsfilter caps=video/x-raw-yuv,format='(fourcc)'NV12,width=720,height=576,framerate='(fraction)'25,pitch=736 ! \
dmaiaccel ! \
dmaienc_h264 copyOutput=false ddrbuf=false encodingpreset=2 ratecontrol=2 single-nalu=true targetbitrate=2000000 maxbitrate=4000000 level=51 intraframeinterval=150 idrinterval=250 t8x8intra=true t8x8inter=true bytestream=false headers=false ! \
flvmux name=mux streamable=true ! \
queue ! \
rtmpsink location="rtmp://live-lhr.twitch.tv/app/live_73242159_p0OUfxtnBGoSwgdcaQVXZ7uRJO3hsM" sync=false enable-last-buffer=false
And if you connect the audio output to the microphone input of the Virtrilka, you can do this:
Script to broadcast on Twitch with sound
gst-launch v4l2src always-copy=false chain-ipipe=true ! \
capsfilter caps=video/x-raw-yuv,format='(fourcc)'NV12,width=$WIDTH,height=$HEIGHT,framerate='(fraction)'$FPS$PITCH ! \
dmaiaccel ! \
dmaienc_h264 copyOutput=false ddrbuf=false encodingpreset=2 ratecontrol=2 single-nalu=true targetbitrate=$BITRATE maxbitrate=4000000 level=51 intraframeinterval=150 idrinterval=250 t8x8intra=true t8x8inter=true bytestream=false headers=false ! \
queue ! \
flvmux streamable=true name=mux \
alsasrc latency-time=200000 buffer-time=4000000 slave-method=3 do-timestamp=false provide-clock=false ! \
capsfilter caps=audio/x-raw-int,channels=1,rate=16000,endianness=1234,signed=true,width=16,depth=16 ! \
queue ! \
dmaienc_aac bitrate=48000 maxbitrate=48000 tns=false copyOutput=false outputBufferSize=500000 fullbandwidth=true fixTimestamp=true ! \
mux. \
mux. ! \
queue ! \
rtmpsink location="rtmp://live-lhr.twitch.tv/app/live_73242159_p0OUfxtnBGoSwgdcaQVXZ7uRJO3hsM" sync=false enable-last-buffer=false
Other applications
Of course, I managed to test only a small part of what can be done with the analog video output. Personally, I like it even more than the HDMI input and than ordinary digital cameras, because it is compatible with a bunch of any equipment.
When we first tweeted about the analog input, several response tweets at once were about connecting a full-time car rear-view camera in order to see a picture on an android device. I don’t have a parking camera in my car, so I can’t check it. And somehow I don’t want to screw the usual one to the bumper :-)
Another person was going to fasten the video output of the telescope to the virtual computer to stream to the Internet. Let's see what he gets in the end.
You can throw your use cases (if they are not secret, of course) into comments. What I can - I’ll quickly test and unsubscribe about the results. Well, or you can check interesting options yourself, the analog module is already on sale. If we see a very interesting application in the comments, we guarantee the author a prize analog input. Of course, only if he already has a Virtualrilka, otherwise the module has nothing to cling to. Well, and if the application is very, very, very interesting - we will give Virtualkylka in full ammunition as well.
We ourselves have already tied up selling devices to end consumers, so now all of our hardware is sold in the Chipster online store . And yes, you yourself know what is happening with the ruble exchange rate, so prices will have to be raised periodically, excuse me.
Offtopic
Not really about the analog module, but also useful for it. Just the day before yesterday as a result of a roof-top experiment, it turned out that Virtrilka, which is actually based on the DM365 processor, works perfectly at the frequencies of the older processor, DM368. I won’t copy-paste , I’ll give a link, if anyone is suddenly interested - http://www.g0l.ru/blog/n4018
In short - our DM365 feels great at frequencies of DM368 (CPU 432 Mhz, DDR 340 MHz). The network works, wifi works, video from cameras, from the analog input, from the HDMI input - everything works as it should. Only now it did not work out to check Full HD video, for lack of a suitable source. How to reconfigure the HDMI input to 1080p or get a sensor with Full HD - I’ll check if it can pull a topic.
The Virtualrilka dispersed in this way has been working continuously for more than 14 hours, the flight is stable. The increased frequency was very useful for HD RTMP broadcasts, where earlier than the usual frequency, 300 MHz was enough for a modest bitrate.
If anyone is interested to try - link to the firmware I
just warn you right away - while this is in the testing phase, I can’t guarantee anything. If the overclocked Virturilka explodes, swells, collapses, annihilates, Virt2real is not responsible for this. So, "You have been warned!", As they say.
Applications
To view RTP video streams on mobile devices, we released the first versions of applications:
Android
iOS
And for viewing on a desktop:
For Windows
Where could I buy?
Online store Chipster.ru