[beta testing] nodes for live streaming mp4

Time for an update. I managed to make it work using the GPU :champagne: :champagne:

  1. Maybe not necessary but I decided to re-build ffmpeg from scratch to get the latest version and also to be sure it really was built with gpu support. Following this guide here:
    (RPi) Compile FFmpeg with the OpenMAX H.264 GPU acceleration · legotheboss/YouTube-files Wiki · GitHub

Except that I used these configure parameters (to link the atomic library which was needed in my case):

./configure --extra-ldflags="-latomic" --arch=armel --target-os=linux --enable-gpl --enable-omx --enable-omx-rpi --enable-nonfree

  1. Edit /boot/config.txt and change to at least gpu_mem=128
    Note: maybe this would have solved my issue, so try this first before re-building the whole ffmpeg package

  2. Reboot

  3. Checking versions

pi@raspberrypi:~ $ ffmpeg -encoders | grep 264
ffmpeg version N-99578-gaf701196ec Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 8 (Raspbian 8.3.0-6+rpi1)
configuration: --extra-ldflags=-latomic --arch=armel --target-os=linux --enable-gpl --enable-omx --enable-omx-rpi --enable-nonfree
libavutil 56. 60.100 / 56. 60.100
libavcodec 58.111.101 / 58.111.101
libavformat 58. 62.100 / 58. 62.100
libavdevice 58. 11.102 / 58. 11.102
libavfilter 7. 87.100 / 7. 87.100
libswscale 5. 8.100 / 5. 8.100
libswresample 3. 8.100 / 3. 8.100
libpostproc 55. 8.100 / 55. 8.100
V..... h264_omx OpenMAX IL H.264 video encoder (codec h264)
V..... h264_v4l2m2m V4L2 mem2mem H.264 encoder wrapper (codec h264)
V..... h264_vaapi H.264/AVC (VAAPI) (codec h264)

  1. Running test

The command line:

ffmpeg -i http://192.168.0.236:8889/?action=stream -pix_fmt yuvj422p -c:v h264_omx -f mp4 -movflags +frag_keyframe+empty_moov+default_base_moof pipe:1

And it works, it's now using the GPU!!! The total CPU load has gone down and is now just around 20% on average and the CPU/GPU temperature seems to stabilize around 58 degrees celsius

The sequence durations are now steady 1 second

[h264_omx @ 0x1b96580] Using OMX.broadcom.video_encode

Output #0, mp4, to 'pipe:1':
Metadata:
encoder : Lavf58.62.100
Stream #0:0: Video: h264 (h264_omx) (avc1 / 0x31637661), yuv420p, 640x480, q=2-31, 200 kb/s, 25 fps, 12800 tbn, 25 tbc
Metadata:
encoder : Lavc58.111.101 h264_omx

frame= 59 fps= 14 q=-0.0 size= 48kB time=00:00:02.28 bitrate= 173.3kbits/s speed=0.543x

etc, etc

The picture quality is however not as good now, don't know why but this is how it looks like. The picture looks distorted

image

2 Likes