Capture raw video and transcode to mkv container

Am having some issues trying to figure out the correct command line string to stream raw video from camera and transcode to mkv or mp4 container using gstreamer.
I currently can get the live feed using:

gst-launch-1.0 v4l2src device=/dev/video0 ! video/x-raw, width=1920, height=1080, format=YUY2, framerate=60/1 ! xvimagesink -e

I don’t yet know exactly what I need (bitrate etc.) for the output file, I had hoped to just do some trial and error to try and get a filesize that works for my application.

If anyone can point me in the right direction, I would appreciate it!

Please try the command:

$ gst-launch-1.0 -e v4l2src device=/dev/video0 num-buffers=300 ! video/x-raw, width=1920, height=1080, format=YUY2, framerate=60/1 ! nvvidconv ! nvv4l2h264enc ! h264parse ! matroskamux ! filesink location=test.mkv

Thank you that worked well. I had initially setup to do it via ffmpeg, but it was using 100% of all cores as it was not using hardware enc. Is there a way, that you know of to use ffmpeg with nvenc?

We have a package enabling hardware decoding in ffmpeg:
Accelerated Decode with ffmpeg — NVIDIA Jetson Linux Developer Guide 1 documentation

For hardware encoding, please use gstreamer or jetson_multimedia_api

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.