Author Topic: How to decode and capture composite video screenshot?  (Read 17476 times)

0 Members and 1 Guest are viewing this topic.

Offline VictoriaTopic starter

  • Newbie
  • Posts: 9
  • Country: es
How to decode and capture composite video screenshot?
« on: March 02, 2024, 05:12:35 pm »
Hi,

we have Comelit intercoms with composite video camera at the main entrance of our house. The intercom inside has one pin CBVS, which is supposed to be composite input (I guess PAL as these products are mainly popular in Europe). That's been discussed here:

https://github.com/plusvic/simplebus2-intercom/issues/7

I'm looking for a way to decode the composite video input (convert to some digital format), capture one screenshot that I can process later on an MCU (ESP32).

What would be the simplest, cheapest solution to capture and digitize one frame from a composite video signal (PAL)?

I have seen some video decoder ICs doing this job, but they are multichannel and relatively complex. Isn't there an ideal IC with one video input and one I2S output or so?

P.S. I'm a total noob in analog video stuff (can do some programming stuff), so forgive me to ask how to digitilize composite video in a simplest way..

Thank you
« Last Edit: March 02, 2024, 05:22:00 pm by Victoria »
 

Offline wasedadoc

  • Super Contributor
  • ***
  • Posts: 1370
  • Country: gb
Re: How to decode and capture composite video screenshot?
« Reply #1 on: March 02, 2024, 05:19:08 pm »
There are lots of USB video grabbers.
 

Offline VictoriaTopic starter

  • Newbie
  • Posts: 9
  • Country: es
Re: How to decode and capture composite video screenshot?
« Reply #2 on: March 02, 2024, 05:26:35 pm »
Thank you. I have noticed such devices, but my overall aim is to send a screenshot when somebody rings the bell over ESP32. And grabbing video stream from USB stick into ESP32 would be probably more challenging than learning how to use those decoder ICs.

That's why I'm hoping for some easier decoder which can be used along with MCU.
 

Offline Benta

  • Super Contributor
  • ***
  • Posts: 5878
  • Country: de
Re: How to decode and capture composite video screenshot?
« Reply #3 on: March 02, 2024, 10:11:46 pm »
This is a complex task.
No, there are no ICs that will do this for you.

The USB video grabbers are just A/D converters that will send some non-standard digitized samples to your PC, and leave all the processing to custom (closed-source) software, which will then generate an MPEG-2 (or MPEG-4) stream.

There is one exception I know of in the consumer realm, but it is obsolete since 10+ years, which is the "Terratec Grabster AV400".
This contains a very advanced Conexant chipset that does all video processing plus MPEG-2 encoding and emits a standardized USB MPEG-2 stream to eg, VLC or any other video software. No need for special drivers.
If you're lucky, you'll find one on eBay.

Frankly, the easy way is to place a BT/WLAN still camera at your door and use that instead.

 

Offline c64

  • Frequent Contributor
  • **
  • Posts: 298
  • Country: au
Re: How to decode and capture composite video screenshot?
« Reply #4 on: March 02, 2024, 10:55:43 pm »
What's wrong with video decoder IC? You will get YCbCr + clock, which you can capture with your ESP32 gpio pins (assuming it can capture at this rate).

YCbCr  is usually 10bit, but you can drop few LSB to save few pins.

If you don't need color, you can discard color information and only use Y component.

 
The following users thanked this post: Victoria

Offline VictoriaTopic starter

  • Newbie
  • Posts: 9
  • Country: es
Re: How to decode and capture composite video screenshot?
« Reply #5 on: March 03, 2024, 12:14:20 am »
What's wrong with video decoder IC? You will get YCbCr + clock, which you can capture with your ESP32 gpio pins (assuming it can capture at this rate).

YCbCr  is usually 10bit, but you can drop few LSB to save few pins.

If you don't need color, you can discard color information and only use Y component.

Thank you. Sounds easy. Yet I need to study the whole format (so like standard output of video decoders ICs is YCbCr + clock?), and I did not find a suitable IC yet. On the ESP, 10 pins plus a few to control the IC I could dedicate.

And I just need one image, not a stream, so the idea would be when the bell rings, I would wake up the decoder chip, wait for it to give the ESP some sort of "new frame" interrupt, read the data stream for exactly one frame and put the decoder to sleep. Then I would build e.g. JPEG from it (reshuffle the buffer I guess) and do whatever else with it. That's the concept.

I have seen this project, but I don't have computer by hand, so I can't see the schematics (and cannot open it online, don't know why), but the TVP5150PBS decoder looks "not so complex" at least for the number of pins and functions I have seen at some others (it is out of stock |O):

https://github.com/11tools/esp32cvbscam

What I'm missing is:

Is there an off the shelf decoder IC which would ideally just let itself wake up (with no extra settings needed) which would, when available, generate "new frame" interrupt and spit out the data stream (which I would buffer until next "new frame" interrupt)? Or even better, cache one frame for me (with that I would not need to worry about the I/O performance)?
« Last Edit: March 03, 2024, 12:19:44 am by Victoria »
 

Offline c64

  • Frequent Contributor
  • **
  • Posts: 298
  • Country: au
Re: How to decode and capture composite video screenshot?
« Reply #6 on: March 03, 2024, 12:29:10 am »
You can still buy TVP5150 @ digikey/mouser
Also, you can check Analog Devices, they has quite an extensive range of video decoders
 
The following users thanked this post: boB, Victoria

Offline c64

  • Frequent Contributor
  • **
  • Posts: 298
  • Country: au
Re: How to decode and capture composite video screenshot?
« Reply #7 on: March 03, 2024, 12:32:56 am »
What I'm missing is:

Is there an off the shelf decoder IC which would ideally just let itself wake up (with no extra settings needed) which would, when available, generate "new frame" interrupt and spit out the data stream (which I would buffer until next "new frame" interrupt)? Or even better, cache one frame for me (with that I would not need to worry about the I/O performance)?
I don't think so. Maybe some unknown manufacturer in China, for some very niche application. Which means no reasonable quality datasheet. You much faster can learn and do it yourself.
 
The following users thanked this post: Victoria

Online BrianHG

  • Super Contributor
  • ***
  • Posts: 7744
  • Country: ca
Re: How to decode and capture composite video screenshot?
« Reply #8 on: March 03, 2024, 12:35:06 am »
I used to use the ADV7182/ADV7183 for my composite/s-video/component video inputs for my video scaler.  It is a premium IC meaning around 10-15$, but all you need is a crystal and some caps, set a few I2C controls and it will deliver the rest for you.

 

Offline Someone

  • Super Contributor
  • ***
  • Posts: 4532
  • Country: au
    • send complaints here
Re: How to decode and capture composite video screenshot?
« Reply #9 on: March 03, 2024, 12:51:19 am »
Video doesnt wait to be leisurely processed. Somewhere in the system you are going to be spending $$ and or resources for a frame buffer that can collect the video at its native rate.

Probably cheaper off switching to some camera module that already has the interface + speed you want.
 
The following users thanked this post: boB, BrianHG, Victoria

Offline globoy

  • Regular Contributor
  • *
  • Posts: 185
  • Country: us
Re: How to decode and capture composite video screenshot?
« Reply #10 on: March 03, 2024, 05:37:19 pm »
I'm not sure if this project will be helpful or not but here's someone doing something similar with NTSC.

https://github.com/wooky/esp32-analog-video-over-wifi
 

Offline VictoriaTopic starter

  • Newbie
  • Posts: 9
  • Country: es
Re: How to decode and capture composite video screenshot?
« Reply #11 on: March 03, 2024, 07:38:06 pm »
Thank you, but no, it's an empty project.

However, I may seem to be lucky. If I use TVP5150, I can get YCbCr 4:2:2 component video which seems to be provided among other formats by cameras like OV7725, which is supported by the ESP32 Camera Driver. It comes even with frame to JPEG conversion example.

Of course, I need to check the pin connection difference and modify the I2C communication because those cameras are certainly controlled in a different way than TVP5150. But the output data stream seems to be the same, so as a starting point I would choose this.
« Last Edit: March 03, 2024, 10:27:15 pm by Victoria »
 

Offline macboy

  • Super Contributor
  • ***
  • Posts: 2256
  • Country: ca
Re: How to decode and capture composite video screenshot?
« Reply #12 on: March 06, 2024, 03:17:31 am »
You will expend tremendous effort building hardware and firmware for this. You can accomplish the task much more easily with a raspberry Pi zero W (under $10) and a cheap USB frame grabber (also under $10), plus Linux, some basic free OS software, and some relatively simple scripts.
 
The following users thanked this post: tooki, Victoria

Offline VictoriaTopic starter

  • Newbie
  • Posts: 9
  • Country: es
Re: How to decode and capture composite video screenshot?
« Reply #13 on: March 08, 2024, 05:23:31 pm »
True. It seems to be complex stuff. Hence I'm considering even giving up on this entirely. It's for the person on the wheelchair and opening the main entrance door to a stranger is not unusual for the fluctuation of people in their house, so I'm thinking to just add camera to the peephole at the flat door (even if it's prohibited here).
« Last Edit: March 08, 2024, 06:42:12 pm by Victoria »
 

Offline tooki

  • Super Contributor
  • ***
  • Posts: 11561
  • Country: ch
Re: How to decode and capture composite video screenshot?
« Reply #14 on: March 08, 2024, 05:47:41 pm »
You will expend tremendous effort building hardware and firmware for this. You can accomplish the task much more easily with a raspberry Pi zero W (under $10) and a cheap USB frame grabber (also under $10), plus Linux, some basic free OS software, and some relatively simple scripts.
I was just going to suggest exactly this.
 

Offline inse

  • Frequent Contributor
  • **
  • Posts: 661
  • Country: de
Re: How to decode and capture composite video screenshot?
« Reply #15 on: March 08, 2024, 07:46:03 pm »
Pointing a camera (module) at the existing display is no solution?
« Last Edit: March 11, 2024, 02:56:45 pm by inse »
 

Offline VictoriaTopic starter

  • Newbie
  • Posts: 9
  • Country: es
Re: How to decode and capture composite video screenshot?
« Reply #16 on: March 11, 2024, 02:43:10 pm »
There's no space for that on the opposite wall. I was considering even intercepting the lane between decoder and display and transmit that, but have not investigated this.
 

Online soldar

  • Super Contributor
  • ***
  • Posts: 3175
  • Country: es
Re: How to decode and capture composite video screenshot?
« Reply #17 on: March 11, 2024, 08:28:34 pm »
how to digitilize composite video in a simplest way..
Not easy and probably not worth the trouble.

PAL carries analog luminance, line by line, and color info separately. If you can do without the color then digitizing to create a bitmap should be doable if your HW is fast enough.
576 lines x 576 * 4 / 3 = 442368 pixels

Should not be to difficult to digitize. Now, if you want color and you want to convert to some compression scheme ike JPG then it becomes exponentially more complicated and not worth it.

You can get IP cams for close to nothing these days so I really do not see the how this is practical. But if you want to do it it could be done.

IP cams, recorders, etc are so cheap I have several  just lying around to play with. And have several outside so I can see all around the house.
All my posts are made with 100% recycled electrons and bare traces of grey matter.
 

Offline Nominal Animal

  • Super Contributor
  • ***
  • Posts: 6264
  • Country: fi
    • My home page and email address
Re: How to decode and capture composite video screenshot?
« Reply #18 on: March 11, 2024, 11:52:02 pm »
Renesas/Intersil TW9990 and TW9992 are composite video decoder ICs available in singles from Mouser for 6-7€.
TW9990 has 8-bit 4:2:2 YCbCr parallel digital output, and TW9992 MIPI output (CSI-2).
Something like ESP32-P4 should work with TW9992.  With TW9990, you'd need 8-bit parallel data input plus sync signal inputs, and sufficient RAM for a full frame (something like 768 pixels per scan line, only part of which will contain data, and 625 scan lines for a full frame).

I would go for one of the really small Linux SBCs, perhaps an Orange Pi Zero 2W (~20€ from AliExpress), NanoPi NEO LTS or NanoPi NEO Air ($15 to $25 from FriendlyElec), instead, with one of the $10-$20 eBay EzCap composite video to USB 2 capture devices that advertise Linux compatibility.  I avoid Raspberry Pis because of their hardware USB is faulty and I just don't like how the Foundation operates.  They have additional GPIO pins available you can use for an external relay for handling the door button.  For something like $50/50€ for a device with upstream Debian/Armbian support, this would make for a quite compact unit that would not consume too much power either.

The video interface will be USB Video, which means a large set of standard Linux UVC utilities will work for both video and for individual image capture.  You can also run Nginx or Apache as your https server over WiFi on the SBC, allowing secure access to the SBC from e.g. your phone without relying on cloud services.  With a bit of help from ffmpeg, you could even stream the audio and video to the web page (and audio back to the door phone), with a door opening button, assuming you do the security correctly (either client and server certificates, or IP-tied cookie-based user password authentication).
« Last Edit: March 11, 2024, 11:53:35 pm by Nominal Animal »
 
The following users thanked this post: Victoria


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf