IMX8MPEVK : vpuenc_h264 set bitrate property does not work.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

IMX8MPEVK : vpuenc_h264 set bitrate property does not work.

1,302 Views
lazy12316
Contributor II

Hello Community,

I am working on encoding and saving camera stream on my imx8mp evk board.

I have custom built yocto image flashed on the evk. I am using gstreamer and hardware accelerated based H264 encoding. My command line is as follows;

gst-launch-1.0 -e v4l2src device=/dev/video3 ! videoconvert ! "video/x-raw, width=1280, height=720" ! vpuenc_h264 bitrate=10000 ! h264parse ! splitmuxsink location=video%0d.mp4 max-files=10 max-time=3000000000

This works as video is saved in the current folder.

However, when i try to check the properties of the saved video, the bitrate field is 0 as shown below

 

Analyzing file:///home/root/video0.mp4

====== AIUR: 4.6.2 build on Aug 27 2021 07:05:03. ======
Core: MPEG4PARSER_06.17.18 build on Apr 14 2021 02:39:48
file: /usr/lib/imx-mm/parser/lib_mp4_parser_arm_elinux.so.3.2
------------------------
Track 00 [video_0] Enabled
Duration: 0:00:18.053666000
Language: und
Mime:
video/x-h264, parsed=(boolean)true, alignment=(string)au, stream-format=(string)avc, width=(int)1280, height=(int)720, framerate=(fraction)1500/49, codec_data=(buffer)0142e00affe100182742e00a898d502802dd3640000003004000000f03c5896e01000528ce025c80
------------------------

====== V4L2DEC: 1.18.0 build on Aug 6 2021 09:27:51. ======
Done discovering file:///home/root/video0.mp4

Properties:
Duration: 0:00:18.053668000
Seekable: yes
Live: no
container: Quicktime
video: H.264 (Constrained Baseline Profile)
Stream ID: 9d2db7c1762a154a4867c0ea5c49bd5b2adb6a2e95c54d44551f432e6b93a155/0
Width: 1280
Height: 720
Depth: 24
Frame rate: 1500/49
Pixel aspect ratio: 1/1
Interlaced: false
Bitrate: 0
Max bitrate: 0

As I suspect that the vpuenc_h264 element is not setting the bitrate. Just to cross verify, I ran similar command on ubuntu by replacing vpuenc_h264 with x264enc element and the output video has the bitrate property set.

 

Could anyone guide me on this issue, if I am missing out something or the process I am following is wrong.

 

Thanks

Tags (2)
0 Kudos
2 Replies

1,288 Views
malik_cisse
Senior Contributor I

Hi,

 

You may try to edit your file with ffprobe or other tools. Your file info tool might be the troublemekr.

I did your test with:
gst-launch-1.0 -e v4l2src device=/dev/video0 ! videoconvert ! "video/x-raw, width=1280, height=720" ! vpuenc_h264 bitrate=10000 ! h264parse ! splitmuxsink location=video.mp4

And bitrate metadata is in the mp4 file as it should:

$ ffprobe video.mp4
ffprobe version 4.2.4-1ubuntu0.1 Copyright (c) 2007-2020 the FFmpeg developers
built with gcc 9 (Ubuntu 9.3.0-10ubuntu2)
configuration: --prefix=/usr --extra-version=1ubuntu0.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-nvenc --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
libavutil 56. 31.100 / 56. 31.100
libavcodec 58. 54.100 / 58. 54.100
libavformat 58. 29.100 / 58. 29.100
libavdevice 58. 8.100 / 58. 8.100
libavfilter 7. 57.100 / 7. 57.100
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 5.100 / 5. 5.100
libswresample 3. 5.100 / 3. 5.100
libpostproc 55. 5.100 / 55. 5.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp42mp41isomiso2
creation_time : 2022-01-28T10:22:10.000000Z
Duration: 00:00:06.72, start: 0.000000, bitrate: 11569 kb/s
Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720, 11564 kb/s, SAR 1:1 DAR 16:9, 33.94 fps, 34 tbr, 3k tbn, 60 tbc (default)
Metadata:
creation_time : 2022-01-28T10:22:10.000000Z
handler_name : VideoHandler

 

My video is attached

0 Kudos

1,293 Views
df123
Contributor II

What Yocto release are you using? I think, I remember this issue and I believe it was fixed by upgrading to a newer Yocto release (>= Hardknott).

0 Kudos