# No way to get video framerate from V4L2 decoder

**URL:** <https://forums.developer.nvidia.com/t/no-way-to-get-video-framerate-from-v4l2-decoder/213990>\
**Category:** Jetson AGX Xavier\
**Tags:** decoder\
**Created:** [May 10, 2022, 10:31pm UTC](https://forums.developer.nvidia.com/t/no-way-to-get-video-framerate-from-v4l2-decoder/213990 "2022-05-10T22:31:23Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![russell9](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@russell9](https://forums.developer.nvidia.com/u/russell9)\
**Post date:** [May 10, 2022, 10:31pm UTC](https://forums.developer.nvidia.com/t/no-way-to-get-video-framerate-from-v4l2-decoder/213990/1 "2022-05-10T22:31:23Z")

</div>

I’m trying to use the jetson multimedia SDK to decode video, and can’t seem to get the video framerate from the API.

It seems like this is typically done with the VIDIOC\_G\_PARM ioctl, which does not seem to be implemented. That ioctl is called in the gstreamer element source, but always fails.

Is there a way to do this? The samples certainly don’t include this functionality.

---

<div class="post-metadata">

**Author:** ![DaneLLL](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/danelll/32/14043_2.png) [@DaneLLL](https://forums.developer.nvidia.com/u/DaneLLL)\
**Post date:** [May 11, 2022, 3:12am UTC](https://forums.developer.nvidia.com/t/no-way-to-get-video-framerate-from-v4l2-decoder/213990/3 "2022-05-11T03:12:56Z")

</div>

Hi,  
The sample is to demonstrate hardware decoding and do not parse VUI to get the information. Please refer to source code of _ffprobe_ to parse out the information. The command for showing the information is

```auto
$ ffprobe ~/out1.265
ffprobe version 3.4.4-0ubuntu0.18.04.1 Copyright (c) 2007-2018 the FFmpeg developers
  built with gcc 7 (Ubuntu/Linaro 7.3.0-16ubuntu3)
  configuration: --prefix=/usr --extra-version=0ubuntu0.18.04.1 --toolchain=hardened --libdir=/usr/lib/aarch64-linux-gnu --incdir=/usr/include/aarch64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  libavutil 55. 78.100 / 55. 78.100
  libavcodec 57.107.100 / 57.107.100
  libavformat 57. 83.100 / 57. 83.100
  libavdevice 57. 10.100 / 57. 10.100
  libavfilter 6.107.100 / 6.107.100
  libavresample 3. 7. 0 / 3. 7. 0
  libswscale 4. 8.100 / 4. 8.100
  libswresample 2. 9.100 / 2. 9.100
  libpostproc 54. 7.100 / 54. 7.100
Input #0, hevc, from '/home/nvidia/out1.265':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: hevc (Main), yuv420p(tv), 1920x1080, 10 fps, 10 tbr, 1200k tbn, 10 tbc

```

---

<div class="post-metadata">

**Author:** ![russell9](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@russell9](https://forums.developer.nvidia.com/u/russell9)\
**Post date:** [May 11, 2022, 2:50pm UTC](https://forums.developer.nvidia.com/t/no-way-to-get-video-framerate-from-v4l2-decoder/213990/4 "2022-05-11T14:50:12Z")

</div>

So I am expected to parse the bitstream manually? It is extremely typical for decoders to provide information from the stream-- cuviddec exposes it in pfnSequenceCallback, Intel’s MFX exposes it directly in the decode surface–I’m unaware of any decoder implementation that doesn’t provide this.

---

<div class="post-metadata">

**Author:** ![DaneLLL](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/danelll/32/14043_2.png) [@DaneLLL](https://forums.developer.nvidia.com/u/DaneLLL)\
**Post date:** [May 12, 2022, 4:36am UTC](https://forums.developer.nvidia.com/t/no-way-to-get-video-framerate-from-v4l2-decoder/213990/5 "2022-05-12T04:36:31Z")

</div>

Hi,  
In current releases there is no implementation for this. Please refer to public code about parsing SPS/VUI and do integration. Frame rate is calculated by

```auto
            uint32_t lNum = sps->vui.time_scale; 
            uint32_t lDenom = sps->vui.num_units_in_tick;

```

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/system/32/68080_2.png) [@system](https://forums.developer.nvidia.com/u/system)\
**Post date:** [June 1, 2022, 3:44am UTC](https://forums.developer.nvidia.com/t/no-way-to-get-video-framerate-from-v4l2-decoder/213990/7 "2022-06-01T03:44:32Z")

</div>

Closed on June 1, 2022, 3:44am UTC

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