Kajan001 0 Posted April 7, 2023 Has anyone figured out how to include hardware encoding in video recording? Especially in Gstreamer. I have researched for weeks and found very little useful information. It seems tinker board and other rock chip based boards just do not have the support for it, but many of the posts are old. Anything? Share this post Link to post Share on other sites
tooz 52 Posted April 10, 2023 hello @Kajan001, for hardware encoding you can use mpph264enc plugin: gst-launch-1.0 videotestsrc num-buffers=512 ! video/x-raw,format=NV12,width=1920,height=1080,framerate=30/1 ! queue ! mpph264enc ! queue ! h264parse ! mpegtsmux ! filesink location=/home/linaro/Desktop/h264.ts Share this post Link to post Share on other sites
Kajan001 0 Posted April 10, 2023 Thanks Tooz! This is what I needed. Cheers! Share this post Link to post Share on other sites
Kajan001 0 Posted April 11, 2023 Works like a charm! This is the stream i tried with audio and video: gst-launch-1.0 -e v4l2src num-buffers=512 ! video/x-raw,format=NV12,width=1920,height=1080,framerate=30/1 ! queue ! mpph264enc ! queue ! h264parse ! mp4mux0. autoaudiosrc ! audio/x-raw,width=16,depth=16,rate=44100,channel=1 ! queue ! audioconvert ! audioresample ! voaacenc ! aacparse ! mp4mux ! filesink location=/home/linaro/testh264-2.mp4 To give other newbies like myself a little more to work on here is the layout, as I understand it. gst-launch-1.0 -e v4l2src num-buffers=512 ! video/x-raw,format=NV12,width=1920,height=1080,framerate=30/1 ! queue ! // this sets the camera source as v4l2 and will stop after 512 buffers have been used (approx 4 minutes ) raw vidoe stream is NV12 1920x108 with 30 fps, pretty obvious, add queue to let the computer keep working the camera while it encodes // mpph264enc ! queue ! // right !encode h.264 via hardware. Nice! h264parse ! // parse for muxing mp4mux0. autoaudiosrc ! // link the video and audio mux for intended parcel format, in this case mp4 audio/x-raw,width=16,depth=16,rate=44100,channel=1 ! queue ! audioconvert ! audioresample ! voaacenc ! aacparse // add audio source and encoding ! mp4mux ! f// mux it together into one file filesink location=/home/linaro/testh264-2.mp4 // sink file where your video will end up! Presto! Share this post Link to post Share on other sites