[FFmpeg-user] FFmpeg 5.1 streaming to Youtube - aborts after some time

Steven Kan steven at kan.org
Fri Aug 12 01:12:09 EEST 2022


> On Aug 11, 2022, at 2:55 PM, Christian <christian9486 at gmx.de> wrote:
> 
> Hello,
> 
> I successfully compiled FFmpeg 5.1 on a Raspberry Pi 4B with newest
> Raspberry Pi OS 64 bit following this guidance
> https://pimylifeup.com/compiling-ffmpeg-raspberry-pi/ (I substituted 5.0
> with 5.1 in the last step).
> 
> I test this setup for continuous Youtube-Streaming and use this command:
> 
> ffmpeg -stream_loop -1 -re -i natur.mp4 -c:v copy -c:a aac -b:a 192k
> -flvflags +no_sequence_end+no_metadata+no_duration_filesize -f flv
> rtmp://a.rtmp.youtube.com/live2/
> 
> natur.mp4 is a 1:20min h.264 encoded video with 1280x720 resolution and
> 25fps. ffprobe natur.mp4:
> 
> ffprobe natur.mp4
> ffprobe version aba74d7 Copyright (c) 2007-2022 the FFmpeg developers
>   built with gcc 10 (Debian 10.2.1-6)
>   configuration: --extra-cflags=-I/usr/local/include
> --extra-ldflags=-L/usr/local/lib --extra-libs='-lpthread -lm -latomic'
> --arch=arm64 --enable-gmp --enable-gpl --enable-libaom --enable-libass
> --enable-libdav1d --enable-libdrm --enable-libfdk-aac
> --enable-libfreetype --enable-libkvazaar --enable-libmp3lame
> --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus
> --enable-librtmp --enable-libsnappy --enable-libsoxr --enable-libssh
> --enable-libvorbis --enable-libvpx --enable-libzimg --enable-libwebp
> --enable-libx264 --enable-libx265 --enable-libxml2 --enable-nonfree
> --enable-version3 --target-os=linux --enable-pthreads --enable-openssl
> --enable-hardcoded-tables
>   libavutil      57. 28.100 / 57. 28.100
>   libavcodec     59. 37.100 / 59. 37.100
>   libavformat    59. 27.100 / 59. 27.100
>   libavdevice    59.  7.100 / 59.  7.100
>   libavfilter     8. 44.100 /  8. 44.100
>   libswscale      6.  7.100 /  6.  7.100
>   libswresample   4.  7.100 /  4.  7.100
>   libpostproc    56.  6.100 / 56.  6.100
> Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'natur.mp4':
>   Metadata:
>     major_brand     : isom
>     minor_version   : 512
>     compatible_brands: isomiso2avc1mp41
>     title           : P1050005
>     album_artist    : Julien Lengelé
>     encoder         : Lavf56.4.101
>     description     : Cette vidéo traite de P1050005
>   Duration: 00:01:19.77, start: 0.000000, bitrate: 7269 kb/s
>   Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661),
> yuv420p(progressive), 1280x720 [SAR 1:1 DAR 16:9], 7268 kb/s, 25 fps, 25
> tbr, 12800 tbn (default)
>     Metadata:
>       handler_name    : VideoHandler
>       vendor_id       : [0][0][0][0]
>   Stream #0:1[0x2](fra): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz,
> stereo, fltp, 2 kb/s (default)
>     Metadata:
>       handler_name    : SoundHandler
>       vendor_id       : [0][0][0][0]
> 
> 
> At a random point of hours/days it stops always with following output:
> 
> frame=113674 fps= 25 q=-1.0 size= 4042995kB time=01:15:51.70
> bitrate=7276.4kbit
> frame=113687 fps= 25 q=-1.0 size= 4043565kB time=01:15:52.22
> bitrate=7276.6kbit
> frame=113699 fps= 25 q=-1.0 size= 4044189kB time=01:15:52.70
> bitrate=7277.0kbit
> frame=113712 fps= 25 q=-1.0 size= 4044697kB time=01:15:53.22
> bitrate=7277.1kbit
> frame=113724 fps= 25 q=-1.0 size= 4045234kB time=01:15:53.70
> bitrate=7277.3kbit
> frame=113737 fps= 25 q=-1.0 size= 4045828kB time=01:15:54.22
> bitrate=7277.5kbit
> frame=113750 fps= 25 q=-1.0 size= 4046335kB time=01:15:54.74
> bitrate=7277.6kbit
> WriteN, RTMP send error 104 (24 bytes)
> WriteN, RTMP send error 32 (59 bytes)
> WriteN, RTMP send error 9 (42 bytes)
> av_interleaved_write_frame(): Operation not permitted
> Last message repeated 2 times
> Error writing trailer of rtmp://a.rtmp.youtube.com/live2/: Operation not
> permitted
> frame=113753 fps= 25 q=-1.0 Lsize= 4046481kB time=01:15:54.90
> bitrate=7277.6kbits/s speed=0.997x
> video:4039503kB audio:1265kB subtitle:0kB other streams:0kB global
> headers:0kB muxing overhead: 0.141384%
> Error closing file rtmp://a.rtmp.youtube.com/live2/: Operation not
> permitted
> [aac @ 0x55b0ab82b0] Qavg: 65536.000
> Conversion failed!
> 

I have been streaming from RPi/ffmpeg to YT for a few years now, and the streams stop from time to time for reasons I never quite figured out. The best I could do was put a watchdog timer on it and the restart the stream when it failed.

Then Google changed the APIs and I could no longer restart the stream ingestion programmatically, even though I could restart the stream from the ffmpeg side. 

So I am very curious to see what you can figure out.


More information about the ffmpeg-user mailing list