VIM3 H.264/H.265 video encoding

Thanks for this - I have had excellent results with tyk_khadas 's patch to libvcodec:

v4l2-ctl -c sensor_ir_cut_set=1,vertical_flip=1
exec gst-launch-1.0 \
	v4l2src device=/dev/video0 \
	! video/x-raw,width=1920,height=1080,framerate=30/1,format=RGB \
	! amlvenc gop=60 bitrate=2500 framerate=30 ! video/x-h264,profile=high \
	! h264parse ! rtph264pay config-interval=1 mtu=1208 \
	! "application/x-rtp, payload=(int)96, ssrc=(uint)555555" \
	!  udpsink host=127.0.0.1 port=${1}

Works great when plugged into our |pipe| webRTC proxy.
However… I would really like to be able to control the bitrate dynamically and to be able to force a new keyframe when one is needed because the 4g connection is variable quality.

amlvenc ignores changes to the bitrate once started and doesn’t generate a keyframe if you set gop=0 during a session.

Is there a way to do this @numbqq ?

@steely-glint @tyk_khadas
Can I use with mjpeg uvc camera ?

I don’t think the amlenc supports mjpeg, so you would need to add a gstreamer node to decode the mjpeg into RGB and add it between in the gstreamer pipeline

Incidentally I did some hacking and added a backdoor way to set the bitrate via a shared memory segment. It isn’t ideal but it lets us change it depending on the quality of the 4g signal.

the code for this is at GitHub - pipe/encoder_libs_aml: Variant that does bitrate changes via shared memory

Each time the h264 library is used it tries to open a shared memory file called /tmp/${pid}.ctl before each frame it checks the 2 bytes and uses them to configure the bitrate and full frame flag of the encoder.

An external program can write to this file asynchronously setting the bits.