Encoding h264 directly

Hi there, I have 3 issues
I have an old machine running Ubuntu 12.0.4 32-bits (which cannot be updated) with a BC-H04120A compression capture card already configured where I can access video using v4linux on /dev/video#. I didn’t find a way to know what driver/server it runs, might be very old (if you know how hints will be appreciated).
The exposed video is encoded in MJPEG. However, I need it in H264. I can use ffmpeg to transform it but it has a cost. Is it possible to manage the capture card so it will output in H264 directly?

Is it possible to monitor the compression card use via any command line tool?

Using ffmpeg, I noticed that each 30 seconds I got errors that let me suspect I have some bad MJPEG encoded frames (EOI missing, emulating, overread 8, error count:65 y=0 x=3). Can it comes from the card itselft or should I look to the analog input?


I haven’t forgotten about this. It’s been many years since we released that card.

Video4Linux was originally not designed for hardware compressed frames and was more ‘raw’ output. The driver assumes you want MJPEG. You can look over this example file to record compressed video directly:

Here is and old shell script that another customer provided for when they were testing h264 that I still have laying around…I’m sorry I can’t provide you much more.

/usr/local/bin/v4l2-ctl --verbose -d /dev/video$DEVICE -v width=704,height=480,pixelformat=H264 --set-parm=FRAMERATE 
/usr/local/bin/v4l2-ctl --verbose -d /dev/video$DEVICE --all 

/usr/local/bin/ffmpeg -i /dev/video$DEVICE -vcodec copy -timecode_frame_start 0 -an -r $FRAMERATE -y output.h264.mp4

Thx for your reply,
I figured out, turns out our ubuntu v4l2 is too old and does not know about the h264 exposure. Updating the system works I can now see h264 directly from the device and use ffmpeg to copy it: ffmpeg -f v4l2 -input_format h264 -i /dev/video1 -c:v copy …

On another topic, we want to try with a windows 10 OS, is there a way to access the device input on windows or is it linux supported ? I might open a new ticket.

EDIT: new ticket