No way to get video framerate from V4L2 decoder

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.

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

$ 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

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.

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

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

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