Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get all bytes of stream from webcam after being compressed by codec with ffmpeg?

I need to capture every single byte of the video stream from webcam -after using commandline-ffmpeg to compress it with codec.

So can you please light me up with somewhat the ffmpeg commandline look like and the strategy to get the output stream into my program written by VB6 or VB.net ? (I need to manipulate with every single byte!) Highly appreciate any suggestion.


Update : I wonder if it's possible to save the output as "avi" file on hard disk and at the same time use my program to read content of the saving file. Can I playback the "part of avi file" that I retrieve while the file is being saved (appended) ? Is there any better file format for writting & reading (recording & playing) at the same time other than "avi" ?

Or any better/faster solution?

like image 594
vantrung -cuncon Avatar asked Jun 23 '14 23:06

vantrung -cuncon


1 Answers

Pelase go through the page https://trac.ffmpeg.org/wiki/Capture/Webcam It is clearly mention there how to capture webcam video using ffmpeg.
Yes you can save avi stream to disk and read from it at the same time, I am sure it is possible in linux because there is no file locking.
Or you can write to a pipe and read it from the pipe frame by frame.
Linux example to capture video and write it to a pipe.
Reading from /dev/video0

ffmpeg -f v4l2 -framerate 25 -video_size 640x480 -i /dev/video0 -f rawvideo -pix_fmt yuv420p pipe1.

You should first create pipe1 to run this command, now you can read from this pipe. Piple is FIFO data strecture in linux which will flush as data is being read. SO this will suit your requirement.

like image 126
Satyam Naolekar Avatar answered Nov 15 '22 05:11

Satyam Naolekar