Saved video plays fast

I’m trying to capture video from a USB webcam located at /dev/video1, convert it from 1920x1080 to 1280x720, and save it file, using Hardware Acceleration.

This is working (in that the file writes), but the file plays back extremely quickly.

gst-launch-1.0 v4l2src device=/dev/video1 ! image/jpeg, width=1280, height=720, framerate=30/1 ! jpegparse ! nvjpegdec ! ‘video/x-raw’ ! nvvidconv ! ‘video/x-raw(memory:NVMM),format=NV12,width=1280,height=720’ ! videorate ! omxh265enc ! ‘video/x-h265, stream-format=(string)byte-stream’! h265parse ! qtmux ! filesink location=test.mp4 -e

I’ve tried this with both image\jpeg and video\x-raw formats and am getting the same result.

Here is the resulting video. You can see it’s running extremely quickly.

Any assistance would be greatly appreciated.

Hi,
It is more like an issue in source. Please check if your source runs in desired framerate:

gst-launch-1.0 v4l2src device=/dev/video1 ! image/jpeg, width=1280, height=720, framerate=30/1 ! jpegparse ! nvjpegdec ! 'video/x-raw' ! nvvidconv ! 'video/x-raw(memory:NVMM),format=NV12,width=1280,height=720' ! fpsdisplaysink text-overlay=0 video-sink=fakesink sync=0 -v

We have deprecated omx plugins. You may try nvv4l2h265enc.

Thanks for the suggestion.

This is an excerpt of my result.

/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0/GstFakeSink:fakesink0: sync = false
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 3, dropped: 0, current: 5.22, average: 5.22
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 6, dropped: 0, current: 4.44, average: 4.80
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 9, dropped: 0, current: 5.44, average: 4.99
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 13, dropped: 0, current: 7.41, average: 5.55
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 18, dropped: 0, current: 8.32, average: 6.12
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 22, dropped: 0, current: 7.97, average: 6.39
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 25, dropped: 0, current: 5.75, average: 6.30
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 30, dropped: 0, current: 8.30, average: 6.57
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 35, dropped: 0, current: 8.30, average: 6.77
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 40, dropped: 0, current: 8.23, average: 6.92
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 45, dropped: 0, current: 8.38, average: 7.06
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 50, dropped: 0, current: 8.52, average: 7.18
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 55, dropped: 0, current: 8.52, average: 7.29
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 60, dropped: 0, current: 8.54, average: 7.38
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 65, dropped: 0, current: 8.46, average: 7.45
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 70, dropped: 0, current: 8.27, average: 7.50
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 75, dropped: 0, current: 8.46, average: 7.56
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 80, dropped: 0, current: 8.68, average: 7.62
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 85, dropped: 0, current: 8.65, average: 7.68
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 90, dropped: 0, current: 8.62, average: 7.72
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 95, dropped: 0, current: 8.32, average: 7.75
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 100, dropped: 0, current: 8.35, average: 7.78
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 105, dropped: 0, current: 8.51, average: 7.81
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 110, dropped: 0, current: 8.45, average: 7.84
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 115, dropped: 0, current: 8.62, average: 7.87
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 120, dropped: 0, current: 8.85, average: 7.91

I’m guessing that’s not as it’s supposed to be?

Hi,
The mode is 720p30 and should see 30fps. Somehow it is only 5~8fps. Please execute

$ sudo nvpmodel -m 0
$ sudo jetson_clocks

And check if you can achieve target fps:

gst-launch-1.0 v4l2src device=/dev/video1 ! image/jpeg, width=1280, height=720, framerate=30/1 ! fpsdisplaysink text-overlay=0 video-sink=fakesink sync=0 -v
gst-launch-1.0 v4l2src device=/dev/video1 io-mode=2 ! image/jpeg, width=1280, height=720, framerate=30/1 ! fpsdisplaysink text-overlay=0 video-sink=fakesink sync=0 -v

Awesome, that seemed to do the trick. EDIT

/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0/GstFakeSink:fakesink0: sync = false
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 16, dropped: 0, current: 31.75, average: 31.75
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 31, dropped: 0, current: 29.53, average: 30.64
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 46, dropped: 0, current: 29.53, average: 30.27
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 61, dropped: 0, current: 29.76, average: 30.14
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 76, dropped: 0, current: 29.53, average: 30.02
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 91, dropped: 0, current: 29.53, average: 29.94
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 106, dropped: 0, current: 29.53, average: 29.88
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 121, dropped: 0, current: 29.76, average: 29.86
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 136, dropped: 0, current: 29.53, average: 29.82
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 151, dropped: 0, current: 29.53, average: 29.80
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 166, dropped: 0, current: 29.76, average: 29.79
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 181, dropped: 0, current: 29.53, average: 29.77
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 196, dropped: 0, current: 29.53, average: 29.75
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 211, dropped: 0, current: 29.53, average: 29.74
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 226, dropped: 0, current: 29.76, average: 29.74
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 241, dropped: 0, current: 29.53, average: 29.72
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 256, dropped: 0, current: 29.53, average: 29.71
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 271, dropped: 0, current: 29.76, average: 29.71
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 286, dropped: 0, current: 29.53, average: 29.71
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 301, dropped: 0, current: 29.53, average: 29.70
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 316, dropped: 0, current: 29.76, average: 29.70
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 331, dropped: 0, current: 29.53, average: 29.69
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 346, dropped: 0, current: 29.53, average: 29.68
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 361, dropped: 0, current: 29.52, average: 29.68
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 376, dropped: 0, current: 29.76, average: 29.68
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 391, dropped: 0, current: 29.53, average: 29.68
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 406, dropped: 0, current: 29.53, average: 29.67
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 421, dropped: 0, current: 29.76, average: 29.67

Thank you very much.

Edit: Just tested my original one you sent

gst-launch-1.0 v4l2src device=/dev/video1 ! image/jpeg, width=1280, height=720, framerate=30/1 ! jpegparse ! nvjpegdec ! 'video/x-raw' ! nvvidconv ! 'video/x-raw(memory:NVMM),format=NV12,width=1280,height=720' ! fpsdisplaysink text-overlay=0 video-sink=fakesink sync=0 -v

, it’s at 15FPS.

/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0/GstFakeSink:fakesink0: sync = false
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 9, dropped: 0, current: 17.42, average: 17.42
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 17, dropped: 0, current: 15.49, average: 16.45
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 25, dropped: 0, current: 15.34, average: 16.08
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 33, dropped: 0, current: 15.75, average: 16.00
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 41, dropped: 0, current: 15.56, average: 15.91
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 49, dropped: 0, current: 15.45, average: 15.83
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 57, dropped: 0, current: 15.40, average: 15.77
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 65, dropped: 0, current: 15.51, average: 15.74
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 73, dropped: 0, current: 15.54, average: 15.72
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 81, dropped: 0, current: 15.20, average: 15.66
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 89, dropped: 0, current: 15.38, average: 15.64
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 97, dropped: 0, current: 15.27, average: 15.61
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 105, dropped: 0, current: 15.59, average: 15.61
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 113, dropped: 0, current: 15.56, average: 15.60
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 121, dropped: 0, current: 15.39, average: 15.59
/GstPipeline:pipeline0/GstFPSDisplaySink:fpsdisplaysink0: last-message = rendered: 129, dropped: 0, current: 15.78, average: 15.60

Hi,
It looks like with io-mode=2, it can achieve 30fps. You may try:

gst-launch-1.0 v4l2src device=/dev/video1 io-mode=2 ! image/jpeg, width=1280, height=720, framerate=30/1 ! jpegparse ! nvv4l2decoder mjpeg=1 ! nvv4l2h265enc ! h265parse ! matroskamux ! filesink location=test.mkv

And check if the framerate is correct.

Also note that jpegparse may kill the framerate to 0/1, so using sync=false may result in frames getting sinked as received that may be too fast. Check the framerates in caps before fpsdisplaysink messages and try removing jpegparse to see if it makes a difference.

Thanks for the assistance. Helped tremendously.