Going from camera video output to mpeg4 files - Page 1
Forum section: electronics / beginners

author: TNb
author_rank: Regular Contributor
timestamp: August 17, 2014, 02:49:27 pm
content: What is the simplest way of converting(in hardware) the output of the camera to the mp4 files? I tried to google some chips that can handle that, but it seems it's not so clear and easy. Of course it depends on camera output format, but I can't find a chip for any format.

author: Richard Crowley
author_rank: Super Contributor
timestamp: August 17, 2014, 02:58:51 pm
content: That is a very complex problem. There is no "single chip" (or even "multi-chip") solution to that. You don't even mention whether you are talking about an analog video signal or a digital video signal here? This is NOT a "DIY" project. It is enormously complex, and commercial solutions are so inexpensive that there isn't any future in trying to roll your own.

author: EEVblog
author_rank: Unknown
timestamp: August 17, 2014, 03:05:17 pm
content: What is the camera output?If it's HDMI then one of these works fine, straight to SD card:http://www.ebay.com/itm/AVerMedia-Live-Gamer-Portable-HD-Game-Capture-for-PC-PS3-Wii-U-Xbox-360-/281147587721?pt=US_Video_Capture_TV_Tuner_Cards&hash=item4175b3bc89

author: kripton2035
author_rank: Super Contributor
timestamp: August 17, 2014, 03:10:55 pm
content: I have some of the same concerns ...I have some video camera modules here, and would like to make them simple ip camerasthere dont seems to be any simple solution that would cost less than the $50 of a new chinese ip camera ...

author: TNb
author_rank: Regular Contributor
timestamp: August 17, 2014, 03:11:26 pm
content: So all that little DIY cameras and arduino camera shields are just for live-streaming and that's all?Kinda sad, it would be nice to save video somehow, maybe not mp4, but any other easy-to-use format.Analog or digital doesn't make much difference if there are no chips out there. I tried to find chips for various formats, no luckQuote from: EEVblog on August 17, 2014, 03:05:17 pmAre there cameras with hdmi output? O_o I'm talking about camera as a component(with some simple circuitry), not a consumer device.NTSC, PAL, RGB, YUV, etc.

author: TNb
author_rank: Regular Contributor
timestamp: August 17, 2014, 03:14:04 pm
content: Quote from: kripton2035 on August 17, 2014, 03:10:55 pmIt's more about fun and knowledge than price for meMaybe for ip camera it makes no sense, but for a lot of other projects it may be difficult to find ready-made solution(for example camera in radio controlled car)And as far as I know ip cameras output in PAL or NTSC, they need some device to convert it too.Sorry, I live in the pastBut many CCTV cameras from old days used this big box that converts PAL to some digital format to store on HDD.

author: Richard Crowley
author_rank: Super Contributor
timestamp: August 17, 2014, 03:30:25 pm
content: The biggest problem is that you are talking about data rates/volumes that are orders of magnitude beyond what typical DIY projects can handle. Like gigabits per second as raw video and 10s of MB/s even compressed down to MP4 (etc.). That kind of data requires specialized board layout and test equipment beyond what typical amateurs have access to. Many (most?) modern digital consumer camcorders have HDMI output. And even SDI is becoming standard in the surveillance industry.If you are really interested (and I am, also), a "teardown" (or at least analysis) of a gadget like Dave's suggested recorder box would be interesting to many of us.

author: Richard Crowley
author_rank: Super Contributor
timestamp: August 17, 2014, 03:37:02 pm
content: For cameras in R/C vehicles (cars, quad-copters, etc.) the most popular choice is probably the GoPro camera which is lightweight, compact, and the newer models even beyond full HD resolution. And then there are the $50 dashboard cameras which record a continuous loop of the last 2 hours of driving. I've wanted to get one of those to play around with. It would have been helpful to have it on my car when the guy drove right into me.

author: TNb
author_rank: Regular Contributor
timestamp: August 17, 2014, 04:00:06 pm
content: Quote from: Richard Crowley on August 17, 2014, 03:37:02 pmeh... seems that the easiest way to solve the problem is to buy cheap-ass dashboard camActually, they don't seems very complex inside, not so many components, the only pain in the ass I can see is soldering all that stuffThough they probably use some obscure ICs that are hard to find... Would be a good idea to order one from China and teardown it to know that the hell they are using

author: TNb
author_rank: Regular Contributor
timestamp: August 17, 2014, 04:16:09 pm
content: Just ordered one, damn, they are supercheap -http://www.ebay.com/itm/Mini-DVR-Camcorder-Sport-Video-Recorder-Digital-Spy-Hidden-Camera-Web-Cam-MD80-/181425202154?pt=LH_DefaultDomain_0&hash=item2a3dc8e3ea6.70$ including shippingRecords to AVI, but anyway, not a bad format.

author: SeanB
author_rank: Super Contributor
timestamp: August 17, 2014, 05:11:46 pm
content: I had one to tear down ( it went swimming.......) so there is not much inside. A camera ( like the teardown of the worlds shittiest camcorder Dave did) on a board, a single double sides board with a SD card slot and a large LSI chip and nothing aside from 2 DC Dc converters and some battery charge stuff along with some flash to store the programming. Then a small LCD to act as a display. Not bad, and does what it says on the box reasonably well. I did try the included suction cup mount for a while ( 5 minutes before it fell off) and then used a drill, tap and a long M5 bolt along with a 1/4 BSW bolt and some nuts and silver solder to make a better holder that mounts to the rear view mirror stub. Took the included power supply and fitted it with new non junk capacitors and slipped it under the head lining and connected it to a switched supply. Now keeps the last couple of hours of driving and loops to reuse the 32G SD card when full.

author: TNb
author_rank: Regular Contributor
timestamp: August 17, 2014, 05:35:45 pm
content: I found that many of these cameras use this chip called SPCA1527A, mostly the cheapest cameras without display use it(though maybe it can also support LCD displays)http://www.icatchtek.com/files/SPCA1527A_PF_V1.pdf

author: atferrari
author_rank: Frequent Contributor
timestamp: August 17, 2014, 05:44:06 pm
content: Quote from: Richard Crowley on August 17, 2014, 03:37:02 pmWhere would you install it? You have just one, right?

author: Richard Crowley
author_rank: Super Contributor
timestamp: August 17, 2014, 05:55:57 pm
content: Quote from: atferrari on August 17, 2014, 05:44:06 pmI was driving straight through the green light intersection and the guy coming from the opposite direction decided to make a left turn directly in to the side of my car. A dashboard/windshield camera would have shown that he made a really stupid driving mistake.OTOH, they are so dirt cheap, you could put one on each side of your car for full 360 degree coverage!

author: miguelvp
author_rank: Super Contributor
timestamp: August 17, 2014, 05:57:55 pm
content: If you want to still do your own, and if by mp4 you mean using a H.264 codec then there are many hardware solutions, the difficulty will be in making the circuit to store it, hopefully the datasheets and documentation are not behind heavy NDAs.http://en.wikipedia.org/wiki/H.264/MPEG-4_AVC_products_and_implementations#Encoding

author: atferrari
author_rank: Frequent Contributor
timestamp: August 18, 2014, 10:52:04 am
content: Quote from: Richard Crowley on August 17, 2014, 05:55:57 pmIn my case, considering my record or incidents, I should install four, with this priority:right siderearleft sidefrontThe most ridiculous: myself on the leftmost lane, a (VERY) old lady on my right, next to me, some 30 m from the corner. She sudenly deided to turn left with no warning nor chance to do nothing.She complained of me for being so upset afterwards.

author: Mechatrommer
author_rank: Super Contributor
timestamp: August 18, 2014, 04:45:18 pm
content: Quote from: TNb on August 17, 2014, 04:16:09 pm<history lesson cap on> avi is file format, or a "recognized m$ extension for video+audio file" so to speak. "modern" avi support many encoders including mpg/mp4, might be exaxctly what you want. but i agree with some the chip can be obscured i also had this kind of mini video. the original avi (uncompressed raw) is extinct. and talking about mp4, its one of mpeg's variant, the descendant of the original mpeg.<history lesson cap off>

author: Richard Crowley
author_rank: Super Contributor
timestamp: August 18, 2014, 05:19:31 pm
content: AVI is a "container file" it can contain audio and/or video that has been encoded with any of hundreds of different codecs. Including several uncompressed and lossless-compressed codecs.An "avi" file type, by itself, tells you NOTHING about how the content was encoded (or can be decoded).H.264 compressed video can be contained in files of many different extension, including (but not limited to) MP4Shooting and editing video since before Dave got his first DMM (and before we had computers).

author: Rigby
author_rank: Super Contributor
timestamp: August 18, 2014, 05:56:45 pm
content: The AVI container format is not without consequences, though.Lots of modern video editing/reencoding software doesn't even read AVI anymore, since nearly everything is wrapped in MP4 or M4V or MOV or what have you. Those are all better containers than AVI, which is why AVI support has all but faded away.The container is more than just a zip-loc bag for the actual stuff you want to move around. The container can enforce very stupid rules on the codecs it contains like "you may not carry more than 2 channels of audio" or "your video resolution shall not exceed 320x240" or so on. Those are slightly exaggerated to aid in understanding.Codec arguments aside, the container DOES matter, and if you can help it, you should avoid AVI. Fortunately we live in a time where AVI support hasn't completely evaporated, so you won't be out to dry if you do use AVI. In 5 years, that might not be the case, if you care about using modern software and codecs.

author: Mechatrommer
author_rank: Super Contributor
timestamp: August 18, 2014, 07:34:49 pm
content: avi has some mechanism to recognise what codec being contained. you dont simply put your own codec inside it and hope any other "avi compliant reader" software to understand or show your custom codec's name. and also i dont think DV-AVI buzz will disappear anytime soon in middle-to-high class video editing industries.

author: denelec
author_rank: Regular Contributor
timestamp: August 18, 2014, 08:46:23 pm
content: Compressing mpeg4 video in real time requires a lot of computing power.That's probably why many cheap cameras use a simpler format like motion jpeg.

author: mariush
author_rank: Super Contributor
timestamp: August 18, 2014, 09:25:14 pm
content: No, they use motion jpeg because it's patent free and they don't have to pay royalties to mpeg-la for mpeg4 avc.Anyway..avi, wmv, mp4, mkv, webm (basically simplified mkv), mov, mts are containers. They store one or more video tracks, one or more audio tracks, and other stuff like subtitles.video and audio is encoded/compressed with codecs that implement particular compression methods... for example xvid codec implements the compression method known as mpeg4 ASPAVI is so old that some of the newer compression methods (xvid/divx aka mpeg4 ASP or h264 or officially named mpeg4 avc ) have to use some hacks and format the stream of data in a particular way just to make it possible to have such compressed data into AVI.MP4 is a container that's basically restricting the video and audio formats to just a few, the most common being mpeg 4 avc for video and AAC for audio.MKV accepts pretty much anything but it's less supported by editing suites. WEBM is basically a mkv simplified, that knows only VP8 and Vorbis at this time.There are chips out there that take video input and do hardware compression and output some digital stream but you'd still need a powerful micro or maybe write the firmware for the built in mcu in that chip (a lot of them have ARM chips as a sort of "management" for that chip, or to make it possible to save the digital stream to a sd card).But anyway... it's not easy.

author: ovnr
author_rank: Frequent Contributor
timestamp: August 18, 2014, 09:33:25 pm
content: Quote from: mariush on August 18, 2014, 09:25:14 pmAnd also, more importantly, because they already have a hardware JPEG encoder. Motion JPEG is just a bunch of standard JPEG images played back sequentially at a hopefully consistent frame rate. There is nothing to it.And as for the original topic: Video is hard. Really hard. This isn't a "learning" opportunity, it's a "get an ulcer and premature hair loss" opportunity. I'd suggest looking at some of the SBCs out there like the Raspberry Pi - maybe some of those can be helpful, but just getting video into a computer of any sort involves a large amount of effort.

author: EEVblog
author_rank: Unknown
timestamp: August 18, 2014, 10:24:55 pm
content: Quote from: Richard Crowley on August 17, 2014, 03:30:25 pmIt will simply have a dedicated MP4 encoding chip. You can't do this sort of encoding in any sort of regular processor. It takes hardware encoding in either an ASIC or FPGA.

author: Mechatrommer
author_rank: Super Contributor
timestamp: August 19, 2014, 08:27:03 am
content: The problem is finding source to the said chip. Once found its no different from any arduino project, just placing those lego together. As proven by china cheapo minituarized spycam, ones picture listed here. And i dont think i,ve heard "motion jpeg" b4, if its sequencing normal jpegs in todays world then its pointless. Mpeg which stands for "motion picture" deviced many years ago is the reason 4 that. I need 2 check back what codec used in my late minicam 4 sure, but i dont think its "motion jpeg" described here.

author: Mechatrommer
author_rank: Super Contributor
timestamp: August 19, 2014, 08:30:52 am
content: If you are thinking putting mpeg encoder into mcu or fpga then thats another thing. Understanding mpeg std and algorithm alone is another hair loss problem.

author: Rigby
author_rank: Super Contributor
timestamp: August 19, 2014, 12:25:37 pm
content: The Raspberry Pi has a hardware MP4 (H.264) encoder built-in... Hardware video encoders aren't rare or hard to find.