messariomar
Posts: 40
Joined: Wed Jun 20, 2018 2:11 pm

ADC for analog video (possible?)

Wed Jul 04, 2018 11:11 am

Hello guys i'm working with an analog camera that have as an output an analogue signal (video flow). do you have any idea of wich converter should i use to convert my analog to digital.
their is a lot of them but don't know wich one would be performing

i found this one mcp3008 but i don't know if it would be enough to convert my signal

User avatar
mahjongg
Forum Moderator
Forum Moderator
Posts: 12978
Joined: Sun Mar 11, 2012 12:19 am
Location: South Holland, The Netherlands

Re: ADC for analog video (possible?)

Wed Jul 04, 2018 11:24 am

NO what you want is not possible!

Such ADC's are far to slow to capture an analog video signal, I'm also certain the PI has no digital interfaces that are fast enough for the job, (to connect any theoretical ADC to that would be fast enough) except for the camera input connector.

the only solution would be a very expensive board that converts composite video to a format that is acceptable through the PI's camera input connector. since a short time they are available, but they contain lots of digital logic, and are very expensive.

messariomar
Posts: 40
Joined: Wed Jun 20, 2018 2:11 pm

Re: ADC for analog video (possible?)

Wed Jul 04, 2018 12:21 pm

what is the maximum frequency that can the digital input of the pi3
catch?

PiGraham
Posts: 3925
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: ADC for analog video (possible?)

Wed Jul 04, 2018 12:51 pm

messariomar wrote:
Wed Jul 04, 2018 11:11 am
Hello guys i'm working with an analog camera that have as an output an analogue signal (video flow). do you have any idea of wich converter should i use to convert my analog to digital.
their is a lot of them but don't know wich one would be performing

i found this one mcp3008 but i don't know if it would be enough to convert my signal
You might be able to track down a composite to CSI2 interface. There have been discussions about the idea. Somone made an HDMI input board using CSI2 input at 1080 30p.

I don't know a product exists that could do what you want, but I think it is technically possible.

You may be able to find a composite input H264 compression USB capture device. It MIGHT work on a Pi.

Failing that you can get low bitrate capture on USB with "EasyCap" devices. You don't get full SD resolution and frame rate but you can grab video and stills. There are various devices under that name and not all work with Pi. Check for compatibility reports.

messariomar
Posts: 40
Joined: Wed Jun 20, 2018 2:11 pm

Re: ADC for analog video (possible?)

Wed Jul 04, 2018 1:33 pm

Thank's for your respond i found some guys that can connect a raspi to an analogue camera using the bnc to usb converter don't know how it work but seems to be a good idea, i'd like also to know if you know some perfoming device that can do this

messariomar
Posts: 40
Joined: Wed Jun 20, 2018 2:11 pm

Re: ADC for analog video (possible?)

Thu Jul 05, 2018 8:34 am

HELLO,
it's me again, i don't understand why we can't get the video signal data using a Can and a raspiberry 3 model B, My signal has a frame rate of 60 HZ and we can find a Can that can convert my signal from analog to digital, and my raspberry can read on frequency of 1.2 ghz so i don't understand why it can't be possible .

Sorry again for my english

User avatar
B.Goode
Posts: 10078
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: ADC for analog video (possible?)

Thu Jul 05, 2018 9:41 am

messariomar wrote:
Thu Jul 05, 2018 8:34 am
HELLO,
it's me again, i don't understand why we can't get the video signal data using a Can and a raspiberry 3 model B, My signal has a frame rate of 60 HZ and we can find a Can that can convert my signal from analog to digital, and my raspberry can read on frequency of 1.2 ghz so i don't understand why it can't be possible .

Sorry again for my english


If you are sure it is possible, go ahead and do it...

If it works you will have met your needs.

If it fails you will have learnt from the experience.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 8659
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: ADC for analog video (possible?)

Thu Jul 05, 2018 10:09 am

If your analogue TV has a frame rate of 60Hz then you must be talking about NTSC (PAL is 50Hz). Technically it's a field rate of 60Hz as the source is interlaced with each field carrying half the lines.

Each frame has 480 lines (576 for PAL), and typically classified as 720 pixels per line (it's analogue, so technically it's infinite horizontal resolution). So we're looking at 345600 pixels per frame, or 10,368,000 pixels/second (frame rate is 30Hz, compared to field rate of 60Hz). You also have blanking periods at the start & end of each line, and at the start and end of each frame, so the actual sample rate during the active pixels is a chunk higher.

That's described the pixel rate. For each pixel you have luma (intensity) and two chroma (colour) signals. You need to have separated out the three channels first as the chroma is modulated on the luma. Each of those needs to be sampled at around 12MHz, minimum 8bits per channel, and the resulting data shipped to the Pi. Without other techniques you're looking at around 288Mbit/s
The only interfaces on the Pi that can realistically carry that level of data are USB and CSI2 (camera).

To use USB there are various devices that can capture analogue video and relay it as YUV data over USB. The performance of these devices varies.
For CSI I know the ADV7282M from Analog Devices works. I have their eval board on my desk), but I don't know of a commercial device using that chip (resulting bitrate is 165Mbit/s as it sends the chroma at half the rate of the luma - look up chroma subsampling).
There is also the PiCapture SD1 board which does a similar thing and uses an FPGA to convert the data back to Bayer to make it look like a standard Pi camera.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

messariomar
Posts: 40
Joined: Wed Jun 20, 2018 2:11 pm

Re: ADC for analog video (possible?)

Thu Jul 05, 2018 11:07 am

thank's for your amazing explanation, you helped me to much to understand how an analogue camera works, but is a Flir camera is also works like an normal camera the stuff of lumma and chroma , this really looks so complicated because i need to transmit the data that i can get from my raspberry to my computer via Ethernet, and as i understand we should first modulate our signal to get the data.

which kind of data the ADV7282M device gives us? and wich kind of solution do you advice me .

Sorry again for my english.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 8659
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: ADC for analog video (possible?)

Thu Jul 05, 2018 11:53 am

If it produces a colour image on your monitor, then you've got all 3 channels. Luma by itself gives monochrome - it's how they upgraded the old broadcast systems to support colour without cutting off all the existing black and white TVs.
Whether you need the colour component is up to your use case.

If you need to transmit the data, then you need to look at H264 compression. The Pi has hardware H264 encode acceleration, so it can handle it easily.

Both USB sticks and the ADV7282M produce one of the family of YUYV formats. This isn't handled natively by the video encoder, but I'm about to push changes which should mean that it does an efficient conversion using a different hardware block. I'm testing it with a a different chip that is producing 1080P60, so NTSC is easy in comparison.
The PiCapture does a lossy conversion to a Bayer format in the FPGA, but that does mean you can use the standard raspivid camera app to capture your video.

Which solution is best? Not one I can advise on.
If you can find a USB device that works, then that's the cheapest option. But be aware that it will be stressing the USB system, and the ethernet connection shares that same USB bus.
The other two solutions are currently either not commercially available, or fairly expensive.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

messariomar
Posts: 40
Joined: Wed Jun 20, 2018 2:11 pm

Re: ADC for analog video (possible?)

Thu Jul 05, 2018 12:11 pm

Thank's for your help i'll make some research again to try to complete the knowledge you brought me thank you again

messariomar
Posts: 40
Joined: Wed Jun 20, 2018 2:11 pm

Re: ADC for analog video (possible?)

Thu Jul 05, 2018 2:26 pm

6by9 wrote: If you can find a USB device that works, then that's the cheapest option. But be aware that it will be stressing the USB system, and the ethernet connection shares that same USB bus.
i'm opting for this solution but can you be more explicit please about how can it's stress the USB system ? i don't understand what do you want to say by this ?

Thank you again i really appreciate your help

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 8659
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: ADC for analog video (possible?)

Thu Jul 05, 2018 2:47 pm

messariomar wrote:
Thu Jul 05, 2018 2:26 pm
i'm opting for this solution but can you be more explicit please about how can it's stress the USB system ? i don't understand what do you want to say by this ?
USB2 has a theoretical maximum throughput of 480Mbit/s, but in reality the overheads drop it by at least 25%.
The Pi's USB controller is not the most efficient, and therefore it does struggle under some conditions.
If your USB video capture device is sending 165Mbit/s (720*480*30fps*16bits/pixel) at the Pi and with some tight timing conditions, then trying to fit in significant levels of keyboard, network, or USB storage traffic may corrupt your video capture. It really comes down to how much buffering does the device has, and that isn't a thing they typically advertise.
Some variants of the EasyCap devices have been found to work, but there are about 3 different chips that are sold under that name.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

messariomar
Posts: 40
Joined: Wed Jun 20, 2018 2:11 pm

Re: ADC for analog video (possible?)

Thu Jul 05, 2018 3:23 pm

Thank's again, ok i understand now, i'm really struggling and hesitating should i choose the USB solution or csi-2 sollution. i think i'll choose the usb see what it's going to give me as a result and if it didn't works correctly i'll move to the ADV7282M .

Thanks again for help

messariomar
Posts: 40
Joined: Wed Jun 20, 2018 2:11 pm

Re: ADC for analog video (possible?)

Tue Jul 10, 2018 3:18 pm

Hello again,
i just got my dispositif that convert me the BNC signal into a USB signal and i have my video that can be shown but i'd like to know how can i read the serial port because i'd like to have the camera yuv data and stock them into txt file ?
i can't know wish serial portshould i read because when i connect my usb there is a lot of port that are deleted and some of them that are added. so i don't know wish one should i read . to have pixels data ?

Best regards

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 8659
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: ADC for analog video (possible?)

Tue Jul 10, 2018 4:29 pm

The video data doesn't come in as serial data, it uses the Video 4 Linux 2 (V4L2) API.
https://linuxtv.org/downloads/v4l-dvb-a ... /v4l2.html

Look for one of the standard V4L2 apps - qv4l2, v42-ctl, GStreamer, Mplayer, VLC, would be the typical ones, although they typically aren't hardware accelerated (GStreamer is the exception).
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

messariomar
Posts: 40
Joined: Wed Jun 20, 2018 2:11 pm

Re: ADC for analog video (possible?)

Fri Jul 13, 2018 9:15 am

so it's impossible to transfert (send) the datas via ethernet, radio... and read them from an another dispositif, so i should absolutelly read them from my raspberry ?

User avatar
Z80 Refugee
Posts: 358
Joined: Sun Feb 09, 2014 1:53 pm

Re: ADC for analog video (possible?)

Fri Jul 13, 2018 9:27 am

Video streaming is not the same as broadcast digital video or the digitised output of an analogue video signal. Video streaming supplies data on demand, so the display device requests the next packet of data only when it is ready for it. Broadcast and digitised video comes in at full speed, whether the receiving device is ready for it or not.

The RPi is perfectly capable of presenting streamed video at modest resolutions, but the only serial port it has capable of video speeds is USB. Don't even think about using the GPIO pins.

The difference with the RPi camera module is that it is (effectively) a web cam, not a video camera.
Military and Automotive Electronics Design Engineer (retired)

For the best service: make your thread title properly descriptive, and put all relevant details in the first post (including links - don't make us search)!

messariomar
Posts: 40
Joined: Wed Jun 20, 2018 2:11 pm

Re: ADC for analog video (possible?)

Fri Jul 13, 2018 10:41 am

Thank you, i understood that now i'm using the serial USB to get my video flow ( and i can see the image of my camera) but it seems that i can't get raw datas, so i need a solution to get them because i don't want that my raspberry act like a cloud but need to send datas from my rasp to computer, and then on my compter transfrom this datas on a image.

Thanks*

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 8659
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: ADC for analog video (possible?)

Fri Jul 13, 2018 11:00 am

Define "raw datas" in your context.

Simply put you're capturing video at very high speed (~170Mbit/s). Ethernet and radio are not going to be able to send those sort of rates easily.
Video compression (eg H264 or MJPEG) reduce the bitrate by making use of areas of similarity within an image, or between successive images. That can bring the bitrate down to 5-25Mbit/s depending on resolution and how pristine you need to keep the image. Those are manageable bitrates for ethernet or wifi (you don't say what your radio link is). This is how internet streaming of video (eg Netflix) work - they use compression to bring the bitrate down.

The Pi has hardware acceleration for H264 or MJPEG video encoding. Most PCs will have the capability to decode either in realtime, either in hardware or in software. The PC should be able to decode the frames into a memory buffer for you as well, so you can process it there if you wish.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

messariomar
Posts: 40
Joined: Wed Jun 20, 2018 2:11 pm

Re: ADC for analog video (possible?)

Fri Jul 13, 2018 12:42 pm

when i'm speaking about raw datas i mean the components of each pixel that normally my converter BNC to usb is sending, when i bought the component i thought i could have the data via usb port but unfortunatlly i understood now that their is some protocols of sending datas (first time to use this kind of camera and that kind of converter).

i didn't understood what you said about your solutions i really can't see how to do that , i'll try to search about what you said .

Thanks and sorry for my bad english

User avatar
Z80 Refugee
Posts: 358
Joined: Sun Feb 09, 2014 1:53 pm

Re: ADC for analog video (possible?)

Fri Jul 13, 2018 9:41 pm

6by9 wrote:
Fri Jul 13, 2018 11:00 am
The Pi has hardware acceleration for H264 or MJPEG video encoding.
I think you mean video decoding.
Military and Automotive Electronics Design Engineer (retired)

For the best service: make your thread title properly descriptive, and put all relevant details in the first post (including links - don't make us search)!

PiGraham
Posts: 3925
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: ADC for analog video (possible?)

Sat Jul 14, 2018 8:06 am

Z80 Refugee wrote:
Fri Jul 13, 2018 9:41 pm
6by9 wrote:
Fri Jul 13, 2018 11:00 am
The Pi has hardware acceleration for H264 or MJPEG video encoding.
I think you mean video decoding.
It does both. If you use raspivid to record a video it uses H264 hardware encoder to compress it.

User avatar
Z80 Refugee
Posts: 358
Joined: Sun Feb 09, 2014 1:53 pm

Re: ADC for analog video (possible?)

Sat Jul 14, 2018 10:32 am

PiGraham wrote:
Sat Jul 14, 2018 8:06 am
It does both. If you use raspivid to record a video it uses H264 hardware encoder to compress it.
Sure, but that isn't going to be real-time, is it? The accelerator hardware can provide real-time decoding.
Military and Automotive Electronics Design Engineer (retired)

For the best service: make your thread title properly descriptive, and put all relevant details in the first post (including links - don't make us search)!

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 8659
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: ADC for analog video (possible?)

Sat Jul 14, 2018 12:25 pm

Z80 Refugee wrote:
Sat Jul 14, 2018 10:32 am
PiGraham wrote:
Sat Jul 14, 2018 8:06 am
It does both. If you use raspivid to record a video it uses H264 hardware encoder to compress it.
Sure, but that isn't going to be real-time, is it? The accelerator hardware can provide real-time decoding.
The hardware blocks on the Pi accelerate both H264 encode and decode, supporting up to level 4.1 (1080P30).
If the OP is feeding data in via a USB video capture device, then that is raw pixel data that wants to be encoded to send over a network. The far end needs to decode it, but he's said that isn't on a Pi.
Latency should be sub 150ms before any network delays.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

Return to “Interfacing (DSI, CSI, I2C, etc.)”