Using Gstreamer Editing Services on a raspberry pi causes v4l2h264enc crash

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


Hello, 


I am trying to find a way to cut a video file (h264/mp4), on a Raspberry Pi 4B, using Gstreamer and hardware acceleration.


I tried Gstreamer Editing Services (package ges-tools): you can reproduce following these two steps:


  1. Creation of a video file (as you probably know the capsfilter for the encode level after the v4l2encoder is mandatory, more details about this follow below)


gst-launch-1.0 videotestsrc num-buffers=100 ! v4l2h264enc ! 'video/x-h264,level=(string)3' ! h264parse ! mp4mux ! filesink location=video.mp4



  1. Attempt to cut the video file using ges-launch


ges-launch-1.0 +clip video.mp4 inpoint=1 duration=1 -o out.mp4 -f "video/quicktime:video/x-h264"


It fails at step 2 with errors in console and in the kernel:


  1. Stderr in console


ERROR from element v4l2h264enc0: Failed to process frame./>

Debugging info: ../sys/v4l2/gstv4l2videoenc.c(828): gst_v4l2_video_enc_handle_frame (): /GESPipeline:gespipeline0/GstEncodeBin:internal-encodebin/v4l2h264enc:v4l2h264enc0:

Maybe be due to not enough memory or failing driver


  1. Kernel error (from dmesg, pretty long: I only paste here the line in red)


[172098.718574] bcm2835-codec bcm2835-codec: bcm2835_codec_start_streaming: Failed enabling i/p port, ret -3



I'm using the newest mainstream 32bits OS for the raspberry pi : Debian version: 11 (bullseye)”, which I downloaded here:

https://www.raspberrypi.com/software/operating-systems/#raspberry-pi-os-32-bit

kernel version: 5.15 32bits,

Gstreamer version is 1.18.4.



I did some investigations (if I can call them as such…): testing v4l2h264dec and v4l2h264enc elements both separately, and together, in pipelines (all of the details are in the post linked above, not sure they are useful for you).


Finding no solution, I asked on the raspberry pi forum on feb 21, 2023, but no solution was offered there: (https://forums.raspberrypi.com/viewtopic.php?t=347790). 

To this date, the post got only one answer, by user “6by9” (labeled as “Raspberry Pi Engineer & Forum Moderator”): according to this user, it seems to be the same problem than the one posted in 2021 here: https://forums.raspberrypi.com/viewtopic.php?f=38&t=305405. (i.e. : the level chosen for the encode does not suit the kernel, the solution being a capsfilter: 'video/x-h264,level=(string)3').


So it seems to be the same problem than in my case. Would you agree?


If so, is there any way to stick to using ges launch in order to reach my goal (cutting a video on a Pi)? I suppose that would involve getting the encoder to choose a level for the encode that suits the kernel/driver? I understand that it is what solves the problem in a pipeline (the 'video/x-h264,level=(string)3' capsfilter after the encoder), but with ges-launch I don’t know if it is possible to do something similar?

It’s okay with me if it means modifying some code in one of the packages (ges, … v4l2h264enc, …) and rebuilding.


If there is no way to solve this issue using ges-launch, what are my other options? (using Gstreamer would be nice of course). I imagined: a custom plugin/element that drops frames, or creating an app and use seeking?


Thank you for at least reading up to this point!


Best regards



[Index of Archives]     [Linux Embedded]     [Linux ARM Kernel]     [Linux for ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux Media]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux