6

I want to test raw/h.264 data encoding/decoding on Raspberry pi using hardware acceleration.

I am capturing raw data from webcam, and gstreamer+openMAX for streaming. Finally I store encoded data in a file. See below example.

when I run this command from pi connected through ssh, using pre-built binaries of gstreamer1.0.

pi@raspberrypi ~ $ gst-launch-1.0 v4l2src device=/dev/video0 ! omxh264enc ! \
"video/x-h264,profile=high" ! h264parse ! queue max-size-bytes=10000000 ! \
matroskamux ! filesink location=test1.mkv

CPU occupancy using top command, it's closely 97%. Data type - x-h264 width 1600 height 1200 profile 100 fps 10.000000

From forum post, I found that lot of work going on transferring the raw frames from the webcam, via the ARM to the GPU then transferring the encoded stream back to the ARM and thence to the SD card. Where as the Raspi camera does not have the same bandwidth/CPU issues since the entire path from camera to encoder is done on the GPU itself, with no ARM involvement except for accepting the stream and sending to SD card - hence low CPU use.

Is there any other way to achieve the above requirement without Raspi cam?

2

The simple answer is no.

You need to rely on what format your USB webcam can provide you with. If it only does mjpeg.. then the only way to re-encode it is as you doing.

Some HD Ready/HD camera supply h264 encapsulated streams. (not RAW like the Pi cam) Then the only thing you have to do is transmit the buffer using gstreamer or ffmpeg (compiled) without any transcoding commands. This works well with cameras like that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.