'ALSA buffer xrun' errors only when running as systemd

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

'ALSA buffer xrun' errors only when running as systemd

Ram Shaffir
Hello,

In the last few weeks, I’m struggling to figure out the reason for why my ffmpeg command that works well when running in the console but has ALSA buffer xrun errors when it runs as a systemd service in RPI, until now I don’t know for sure where the problem is, is it in the alsa settings or in my ffmpeg command; I truly hope you’ll help me point me to the right solution!

the ffmpeg command I use is:

segmentSeconds = 10
moveSound = '1.25'
videoOut = 'video0'

ffmpeg = ['sudo', f'{ramDisk}ffmpeg', '-nostdin', '-threads', 'auto', '-y', '-re', '-f', 'v4l2', '-video_size', '1920x1080', '-input_format', 'yuyv422',  '-fflags', '+genpts', '-flags', '+global_header', '-i', f'/dev/{videoOut}', '-f', 'alsa', '-ac', '2', '-ar', '48000', '-itsoffset', f'{moveSound}', '-i', 'default',  '-vcodec', 'h264_omx', '-s', '1280x720', '-r', '30', '-framerate', '30', '-g', '30', '-sc_threshold', '0', '-keyint_min', '30', '-force_key_frames', f"expr:gte(t,n_forced*{segmentSeconds})",  '-pix_fmt', 'yuv420p', '-b:a', '128K', '-b:v', '10M', '-minrate', '10M', '-maxrate', '10M', '-bufsize', '20M', '-f', 'mp4', '-f', 'segment',  '-segment_time', f'{segmentSeconds}', '-reset_timestamps', '1', '-muxdelay', '0', '-muxpreload', '0', f'{ramDisk}{mp4_file_name}']

when calling the command from the console, the video output is ok:

2020-07-02 14:05:28,515: <module> : #42 :ffmpeg version 4.1.4-1+rpt7~deb10u1 Copyright (c) 2000-2019 the FFmpeg developers

2020-07-02 14:05:28,516: <module> : #42 :  built with gcc 8 (Raspbian 8.3.0-6+rpi1)

2020-07-02 14:05:28,520: <module> : #42 :  configuration: --prefix=/usr --extra-version='1+rpt7~deb10u1' --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --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-opengl --enable-sdl2 --enable-omx-rpi --enable-mmal --enable-neon --enable-rpi --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared --libdir=/usr/lib/arm-linux-gnueabihf --cpu=arm1176jzf-s --arch=arm

2020-07-02 14:05:28,521: <module> : #42 :  WARNING: library configuration mismatch

2020-07-02 14:05:28,521: <module> : #42 :  avutil      configuration: --prefix=/usr --extra-version='1+rpt7~deb10u1' --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --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-opengl --enable-sdl2 --enable-omx-rpi --enable-mmal --enable-neon --enable-rpi --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --libdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=cortex-a7 --arch=armv6t2 --disable-thumb --enable-shared --disable-doc --disable-programs

2020-07-02 14:05:28,522: <module> : #42 :  avcodec     configuration: --prefix=/usr --extra-version='1+rpt7~deb10u1' --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --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-opengl --enable-sdl2 --enable-omx-rpi --enable-mmal --enable-neon --enable-rpi --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --libdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=cortex-a7 --arch=armv6t2 --disable-thumb --enable-shared --disable-doc --disable-programs

2020-07-02 14:05:28,523: <module> : #42 :  avformat    configuration: --prefix=/usr --extra-version='1+rpt7~deb10u1' --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --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-opengl --enable-sdl2 --enable-omx-rpi --enable-mmal --enable-neon --enable-rpi --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --libdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=cortex-a7 --arch=armv6t2 --disable-thumb --enable-shared --disable-doc --disable-programs

2020-07-02 14:05:28,524: <module> : #42 :  avdevice    configuration: --prefix=/usr --extra-version='1+rpt7~deb10u1' --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --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-opengl --enable-sdl2 --enable-omx-rpi --enable-mmal --enable-neon --enable-rpi --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --libdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=cortex-a7 --arch=armv6t2 --disable-thumb --enable-shared --disable-doc --disable-programs

2020-07-02 14:05:28,524: <module> : #42 :  avfilter    configuration: --prefix=/usr --extra-version='1+rpt7~deb10u1' --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --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-opengl --enable-sdl2 --enable-omx-rpi --enable-mmal --enable-neon --enable-rpi --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --libdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=cortex-a7 --arch=armv6t2 --disable-thumb --enable-shared --disable-doc --disable-programs

2020-07-02 14:05:28,525: <module> : #42 :  avresample  configuration: --prefix=/usr --extra-version='1+rpt7~deb10u1' --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --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-opengl --enable-sdl2 --enable-omx-rpi --enable-mmal --enable-neon --enable-rpi --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --libdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=cortex-a7 --arch=armv6t2 --disable-thumb --enable-shared --disable-doc --disable-programs

2020-07-02 14:05:28,525: <module> : #42 :  swscale     configuration: --prefix=/usr --extra-version='1+rpt7~deb10u1' --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --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-opengl --enable-sdl2 --enable-omx-rpi --enable-mmal --enable-neon --enable-rpi --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --libdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=cortex-a7 --arch=armv6t2 --disable-thumb --enable-shared --disable-doc --disable-programs

2020-07-02 14:05:28,526: <module> : #42 :  swresample  configuration: --prefix=/usr --extra-version='1+rpt7~deb10u1' --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --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-opengl --enable-sdl2 --enable-omx-rpi --enable-mmal --enable-neon --enable-rpi --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --libdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=cortex-a7 --arch=armv6t2 --disable-thumb --enable-shared --disable-doc --disable-programs

2020-07-02 14:05:28,526: <module> : #42 :  postproc    configuration: --prefix=/usr --extra-version='1+rpt7~deb10u1' --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --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-opengl --enable-sdl2 --enable-omx-rpi --enable-mmal --enable-neon --enable-rpi --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --libdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=cortex-a7 --arch=armv6t2 --disable-thumb --enable-shared --disable-doc --disable-programs

2020-07-02 14:05:28,527: <module> : #42 :  libavutil      56. 22.100 / 56. 22.100
2020-07-02 14:05:28,527: <module> : #42 :  libavcodec     58. 35.100 / 58. 35.100
2020-07-02 14:05:28,527: <module> : #42 :  libavformat    58. 20.100 / 58. 20.100
2020-07-02 14:05:28,528: <module> : #42 :  libavdevice    58.  5.100 / 58.  5.100
2020-07-02 14:05:28,528: <module> : #42 :  libavfilter     7. 40.101 /  7. 40.101
2020-07-02 14:05:28,529: <module> : #42 :  libavresample   4.  0.  0 /  4.  0.  0
2020-07-02 14:05:28,529: <module> : #42 :  libswscale      5.  3.100 /  5.  3.100
2020-07-02 14:05:28,529: <module> : #42 :  libswresample   3.  3.100 /  3.  3.100
2020-07-02 14:05:28,530: <module> : #42 :  libpostproc    55.  3.100 / 55.  3.100
2020-07-02 14:05:28,892: <module> : #42 :Input #0, video4linux2,v4l2, from '/dev/video0':
2020-07-02 14:05:28,903: <module> : #42 :  Duration: N/A, start: 12548.777547, bitrate: 1988671 kb/s
2020-07-02 14:05:28,907: <module> : #42 :    Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 1920x1080, 1988671 kb/s, 59.94 fps, 59.94 tbr, 1000k tbn, 1000k tbc
2020-07-02 14:05:29,112: <module> : #42 :Guessed Channel Layout for Input Stream #1.0 : stereo
2020-07-02 14:05:29,120: <module> : #42 :Input #1, alsa, from 'default':
2020-07-02 14:05:29,124: <module> : #42 :  Duration: N/A, start: 1593687929.107799, bitrate: 1536 kb/s
2020-07-02 14:05:29,127: <module> : #42 :    Stream #1:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
2020-07-02 14:05:29,141: <module> : #42 :Stream mapping:
2020-07-02 14:05:29,148: <module> : #42 :  Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (h264_omx))
2020-07-02 14:05:29,157: <module> : #42 :  Stream #1:0 -> #0:1 (pcm_s16le (native) -> aac (native))
2020-07-02 14:05:29,195: <module> : #42 :[h264_omx @ 0x1ab2f20] Using OMX.broadcom.video_encode
2020-07-02 14:05:29,208: <module> : #42 :[alsa @ 0x1a98180] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
2020-07-02 14:05:29,220: <module> : #42 :[segment @ 0x1ab16e0] Opening '/usr/ramDisk/0.mp4' for writing
2020-07-02 14:05:29,223: <module> : #42 :Output #0, segment, to '/usr/ramDisk/%d.mp4':
2020-07-02 14:05:29,224: <module> : #42 :  Metadata:
2020-07-02 14:05:29,224: <module> : #42 :    encoder         : Lavf58.20.100
2020-07-02 14:05:29,225: <module> : #42 :    Stream #0:0: Video: h264 (h264_omx), yuv420p(progressive), 1280x720, q=2-31, 10000 kb/s, 30 fps, 15360 tbn, 30 tbc
2020-07-02 14:05:29,226: <module> : #42 :    Metadata:
2020-07-02 14:05:29,226: <module> : #42 :      encoder         : Lavc58.35.100 h264_omx
2020-07-02 14:05:29,226: <module> : #42 :    Stream #0:1: Audio: aac (LC), 48000 Hz, stereo, fltp, 128 kb/s
2020-07-02 14:05:29,227: <module> : #42 :    Metadata:
2020-07-02 14:05:29,227: <module> : #42 :      encoder         : Lavc58.35.100 aac
2020-07-02 14:05:29,228: <module> : #42 :[video4linux2,v4l2 @ 0x1a95610] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
2020-07-02 14:05:41,104: <module> : #42 :frame=    7 fps=0.0 q=-0.0 size=N/A time=00:00:01.25 bitrate=N/A dup=0 drop=2 speed=2.37x
frame=   14 fps= 13 q=-0.0 size=N/A time=00:00:01.25 bitrate=N/A dup=0 drop=8 speed=1.17x
frame=   24 fps= 15 q=-0.0 size=N/A time=00:00:01.25 bitrate=N/A dup=0 drop=8 speed=0.793x
frame=   32 fps= 15 q=-0.0 size=N/A time=00:00:01.25 bitrate=N/A dup=0 drop=11 speed=0.591x
frame=   40 fps= 15 q=-0.0 size=N/A time=00:00:01.25 bitrate=N/A dup=1 drop=13 speed=0.47x
frame=   53 fps= 17 q=-0.0 size=N/A time=00:00:01.66 bitrate=N/A dup=5 drop=13 speed=0.526x
frame=   67 fps= 18 q=-0.0 size=N/A time=00:00:02.13 bitrate=N/A dup=10 drop=13 speed=0.575x
frame=   81 fps= 19 q=-0.0 size=N/A time=00:00:02.60 bitrate=N/A dup=15 drop=13 speed=0.611x
frame=   93 fps= 19 q=-0.0 size=N/A time=00:00:03.00 bitrate=N/A dup=19 drop=13 speed=0.628x
frame=  108 fps= 20 q=-0.0 size=N/A time=00:00:03.50 bitrate=N/A dup=26 drop=13 speed=0.663x
frame=  122 fps= 21 q=-0.0 size=N/A time=00:00:03.96 bitrate=N/A dup=32 drop=13 speed=0.687x
frame=  135 fps= 21 q=-0.0 size=N/A time=00:00:04.40 bitrate=N/A dup=38 drop=13 speed=0.697x
frame=  150 fps= 22 q=-0.0 size=N/A time=00:00:04.90 bitrate=N/A dup=45 drop=13 speed=0.718x
frame=  165 fps= 22 q=-0.0 size=N/A time=00:00:05.40 bitrate=N/A dup=52 drop=13 speed=0.735x
frame=  180 fps= 23 q=-0.0 size=N/A time=00:00:05.90 bitrate=N/A dup=59 drop=13 speed=0.747x
frame=  198 fps= 23 q=-0.0 size=N/A time=00:00:06.50 bitrate=N/A dup=69 drop=13 speed=0.771x
frame=  213 fps= 24 q=-0.0 size=N/A time=00:00:07.00 bitrate=N/A dup=76 drop=13 speed=0.783x
frame=  229 fps= 24 q=-0.0 size=N/A time=00:00:07.53 bitrate=N/A dup=84 drop=13 speed=0.798x
frame=  246 fps= 25 q=-0.0 size=N/A time=00:00:08.10 bitrate=N/A dup=93 drop=13 speed=0.813x
frame=  262 fps= 25 q=-0.0 size=N/A time=00:00:08.63 bitrate=N/A dup=101 drop=13 speed=0.824x
frame=  277 fps= 25 q=-0.0 size=N/A time=00:00:09.13 bitrate=N/A dup=108 drop=13 speed=0.831x
frame=  291 fps= 25 q=-0.0 size=N/A time=00:00:09.60 bitrate=N/A dup=115 drop=13 speed=0.833x
[segment @ 0x1ab16e0] Opening '/usr/ramDisk/1.mp4' for writing

When I call the same ffmpeg command from a systemd then I get the alsa errors, and the video output is messed up:

2020-07-02 14:08:52,062: <module> : #42 :ffmpeg version 4.1.4-1+rpt7~deb10u1 Copyright (c) 2000-2019 the FFmpeg developers
2020-07-02 14:08:52,063: <module> : #42 :  built with gcc 8 (Raspbian 8.3.0-6+rpi1)
2020-07-02 14:08:52,063: <module> : #42 :  configuration: --prefix=/usr --extra-version='1+rpt7~deb10u1' --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --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-opengl --enable-sdl2 --enable-omx-rpi --enable-mmal --enable-neon --enable-rpi --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared --libdir=/usr/lib/arm-linux-gnueabihf --cpu=arm1176jzf-s --arch=arm
2020-07-02 14:08:52,063: <module> : #42 :  WARNING: library configuration mismatch
2020-07-02 14:08:52,063: <module> : #42 :  avutil      configuration: --prefix=/usr --extra-version='1+rpt7~deb10u1' --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --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-opengl --enable-sdl2 --enable-omx-rpi --enable-mmal --enable-neon --enable-rpi --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --libdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=cortex-a7 --arch=armv6t2 --disable-thumb --enable-shared --disable-doc --disable-programs
2020-07-02 14:08:52,064: <module> : #42 :  avcodec     configuration: --prefix=/usr --extra-version='1+rpt7~deb10u1' --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --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-opengl --enable-sdl2 --enable-omx-rpi --enable-mmal --enable-neon --enable-rpi --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --libdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=cortex-a7 --arch=armv6t2 --disable-thumb --enable-shared --disable-doc --disable-programs

2020-07-02 14:08:52,064: <module> : #42 :  avformat    configuration: --prefix=/usr --extra-version='1+rpt7~deb10u1' --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --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-opengl --enable-sdl2 --enable-omx-rpi --enable-mmal --enable-neon --enable-rpi --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --libdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=cortex-a7 --arch=armv6t2 --disable-thumb --enable-shared --disable-doc --disable-programs

2020-07-02 14:08:52,064: <module> : #42 :  avdevice    configuration: --prefix=/usr --extra-version='1+rpt7~deb10u1' --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --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-opengl --enable-sdl2 --enable-omx-rpi --enable-mmal --enable-neon --enable-rpi --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --libdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=cortex-a7 --arch=armv6t2 --disable-thumb --enable-shared --disable-doc --disable-programs

2020-07-02 14:08:52,064: <module> : #42 :  avfilter    configuration: --prefix=/usr --extra-version='1+rpt7~deb10u1' --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --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-opengl --enable-sdl2 --enable-omx-rpi --enable-mmal --enable-neon --enable-rpi --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --libdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=cortex-a7 --arch=armv6t2 --disable-thumb --enable-shared --disable-doc --disable-programs

2020-07-02 14:08:52,064: <module> : #42 :  avresample  configuration: --prefix=/usr --extra-version='1+rpt7~deb10u1' --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --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-opengl --enable-sdl2 --enable-omx-rpi --enable-mmal --enable-neon --enable-rpi --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --libdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=cortex-a7 --arch=armv6t2 --disable-thumb --enable-shared --disable-doc --disable-programs

2020-07-02 14:08:52,065: <module> : #42 :  swscale     configuration: --prefix=/usr --extra-version='1+rpt7~deb10u1' --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --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-opengl --enable-sdl2 --enable-omx-rpi --enable-mmal --enable-neon --enable-rpi --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --libdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=cortex-a7 --arch=armv6t2 --disable-thumb --enable-shared --disable-doc --disable-programs

2020-07-02 14:08:52,065: <module> : #42 :  swresample  configuration: --prefix=/usr --extra-version='1+rpt7~deb10u1' --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --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-opengl --enable-sdl2 --enable-omx-rpi --enable-mmal --enable-neon --enable-rpi --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --libdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=cortex-a7 --arch=armv6t2 --disable-thumb --enable-shared --disable-doc --disable-programs

2020-07-02 14:08:52,065: <module> : #42 :  postproc    configuration: --prefix=/usr --extra-version='1+rpt7~deb10u1' --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --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-opengl --enable-sdl2 --enable-omx-rpi --enable-mmal --enable-neon --enable-rpi --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --libdir=/usr/lib/arm-linux-gnueabihf/neon/vfp --cpu=cortex-a7 --arch=armv6t2 --disable-thumb --enable-shared --disable-doc --disable-programs

2020-07-02 14:08:52,065: <module> : #42 :  libavutil      56. 22.100 / 56. 22.100
2020-07-02 14:08:52,065: <module> : #42 :  libavcodec     58. 35.100 / 58. 35.100
2020-07-02 14:08:52,066: <module> : #42 :  libavformat    58. 20.100 / 58. 20.100
2020-07-02 14:08:52,066: <module> : #42 :  libavdevice    58.  5.100 / 58.  5.100
2020-07-02 14:08:52,066: <module> : #42 :  libavfilter     7. 40.101 /  7. 40.101
2020-07-02 14:08:52,066: <module> : #42 :  libavresample   4.  0.  0 /  4.  0.  0
2020-07-02 14:08:52,066: <module> : #42 :  libswscale      5.  3.100 /  5.  3.100
2020-07-02 14:08:52,066: <module> : #42 :  libswresample   3.  3.100 /  3.  3.100
2020-07-02 14:08:52,067: <module> : #42 :  libpostproc    55.  3.100 / 55.  3.100
2020-07-02 14:08:52,426: <module> : #42 :Input #0, video4linux2,v4l2, from '/dev/video0':
2020-07-02 14:08:52,436: <module> : #42 :  Duration: N/A, start: 12752.300645, bitrate: 1988671 kb/s
2020-07-02 14:08:52,436: <module> : #42 :    Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 1920x1080, 1988671 kb/s, 59.94 fps, 59.94 tbr, 1000k tbn, 1000k tbc
2020-07-02 14:08:52,637: <module> : #42 :Guessed Channel Layout for Input Stream #1.0 : stereo
2020-07-02 14:08:52,637: <module> : #42 :Input #1, alsa, from 'default':
2020-07-02 14:08:52,638: <module> : #42 :  Duration: N/A, start: 1593688132.294362, bitrate: 1536 kb/s
2020-07-02 14:08:52,638: <module> : #42 :    Stream #1:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
2020-07-02 14:08:52,639: <module> : #42 :Stream mapping:
2020-07-02 14:08:52,640: <module> : #42 :  Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (h264_omx))
2020-07-02 14:08:52,640: <module> : #42 :  Stream #1:0 -> #0:1 (pcm_s16le (native) -> aac (native))
2020-07-02 14:08:52,708: <module> : #42 :[h264_omx @ 0x1375e70] Using OMX.broadcom.video_encode
2020-07-02 14:08:52,722: <module> : #42 :[alsa @ 0x1338180] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
2020-07-02 14:08:52,733: <module> : #42 :[segment @ 0x13747a0] Opening '/usr/ramDisk/0.mp4' for writing
2020-07-02 14:08:52,735: <module> : #42 :Output #0, segment, to '/usr/ramDisk/%d.mp4':
2020-07-02 14:08:52,735: <module> : #42 :  Metadata:
2020-07-02 14:08:52,736: <module> : #42 :    encoder         : Lavf58.20.100
2020-07-02 14:08:52,736: <module> : #42 :    Stream #0:0: Video: h264 (h264_omx), yuv420p(progressive), 1280x720, q=2-31, 10000 kb/s, 30 fps, 15360 tbn, 30 tbc
2020-07-02 14:08:52,736: <module> : #42 :    Metadata:
2020-07-02 14:08:52,736: <module> : #42 :      encoder         : Lavc58.35.100 h264_omx
2020-07-02 14:08:52,736: <module> : #42 :    Stream #0:1: Audio: aac (LC), 48000 Hz, stereo, fltp, 128 kb/s
2020-07-02 14:08:52,737: <module> : #42 :    Metadata:
2020-07-02 14:08:52,737: <module> : #42 :      encoder         : Lavc58.35.100 aac
2020-07-02 14:08:52,737: <module> : #42 :[video4linux2,v4l2 @ 0x1335610] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
2020-07-02 14:08:55,227: <module> : #42 :frame=    7 fps=0.0 q=-0.0 size=N/A time=00:00:01.25 bitrate=N/A dup=0 drop=2 speed=2.46x
frame=   14 fps= 14 q=-0.0 size=N/A time=00:00:01.25 bitrate=N/A dup=0 drop=7 speed=1.24x
frame=   23 fps= 15 q=-0.0 size=N/A time=00:00:01.25 bitrate=N/A dup=0 drop=9 speed=0.805x
frame=   31 fps= 15 q=-0.0 size=N/A time=00:00:01.25 bitrate=N/A dup=0 drop=12 speed=0.605x
[alsa @ 0x1338180] ALSA buffer xrun.
2020-07-02 14:08:58,180: <module> : #42 :frame=   40 fps= 15 q=-0.0 size=N/A time=00:00:01.27 bitrate=N/A dup=1 drop=13 speed=0.491x
frame=   54 fps= 17 q=-0.0 size=N/A time=00:00:03.87 bitrate=N/A dup=5 drop=13 speed=1.25x
frame=   69 fps= 19 q=-0.0 size=N/A time=00:00:03.87 bitrate=N/A dup=10 drop=13 speed=1.07x
frame=   83 fps= 20 q=-0.0 size=N/A time=00:00:03.87 bitrate=N/A dup=14 drop=13 speed=0.926x
frame=   98 fps= 21 q=-0.0 size=N/A time=00:00:03.87 bitrate=N/A dup=20 drop=13 speed=0.823x
frame=  113 fps= 22 q=-0.0 size=N/A time=00:00:03.87 bitrate=N/A dup=26 drop=13 speed=0.739x
[alsa @ 0x1338180] ALSA buffer xrun.
2020-07-02 14:09:01,145: <module> : #42 :frame=  126 fps= 22 q=-0.0 size=N/A time=00:00:04.12 bitrate=N/A dup=31 drop=13 speed=0.715x
frame=  143 fps= 23 q=-0.0 size=N/A time=00:00:06.82 bitrate=N/A dup=38 drop=13 speed=1.08x
frame=  159 fps= 23 q=-0.0 size=N/A time=00:00:06.82 bitrate=N/A dup=45 drop=13 speed=   1x
frame=  175 fps= 24 q=-0.0 size=N/A time=00:00:06.82 bitrate=N/A dup=52 drop=13 speed=0.93x
frame=  191 fps= 24 q=-0.0 size=N/A time=00:00:06.82 bitrate=N/A dup=59 drop=13 speed=0.868x
frame=  207 fps= 25 q=-0.0 size=N/A time=00:00:06.82 bitrate=N/A dup=66 drop=13 speed=0.814x
[alsa @ 0x1338180] ALSA buffer xrun.
2020-07-02 14:09:04,124: <module> : #42 :frame=  220 fps= 25 q=-0.0 size=N/A time=00:00:07.28 bitrate=N/A dup=71 drop=13 speed=0.817x
frame=  237 fps= 25 q=-0.0 size=N/A time=00:00:09.79 bitrate=N/A dup=78 drop=13 speed=1.04x
frame=  253 fps= 25 q=-0.0 size=N/A time=00:00:09.79 bitrate=N/A dup=85 drop=13 speed=0.985x
frame=  269 fps= 26 q=-0.0 size=N/A time=00:00:09.79 bitrate=N/A dup=92 drop=13 speed=0.935x
frame=  285 fps= 26 q=-0.0 size=N/A time=00:00:09.79 bitrate=N/A dup=99 drop=13 speed=0.89x
[alsa @ 0x1338180] ALSA buffer xrun.
2020-07-02 14:09:04,369: <module> : #42 :frame=  299 fps= 26 q=-0.0 size=N/A time=00:00:09.88 bitrate=N/A dup=105 drop=13 speed=0.855x
[segment @ 0x13747a0] Opening '/usr/ramDisk/1.mp4' for writing

When ffprobe the two videos all is the same but the audio bitrate:

ffprobe version N-80386-g5f5a97d Copyright (c) 2007-2016 the FFmpeg developers
  built with gcc 5.4.0 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-nvenc --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmfx --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib
  libavutil      55. 24.100 / 55. 24.100
  libavcodec     57. 46.100 / 57. 46.100
  libavformat    57. 38.100 / 57. 38.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 46.101 /  6. 46.101
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
  libpostproc    54.  0.100 / 54.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '_0.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.20.100
  Duration: 00:00:10.00, start: 0.000000, bitrate: 4176 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720, 4055 kb/s, 30 fps, 30 tbr, 15360 tbn, 30720 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 127 kb/s (default)
    Metadata:
      handler_name    : SoundHandler

and for the systemd video output:

ffprobe version N-80386-g5f5a97d Copyright (c) 2007-2016 the FFmpeg developers
  built with gcc 5.4.0 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-nvenc --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmfx --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib
  libavutil      55. 24.100 / 55. 24.100
  libavcodec     57. 46.100 / 57. 46.100
  libavformat    57. 38.100 / 57. 38.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 46.101 /  6. 46.101
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
  libpostproc    54.  0.100 / 54.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '0.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.20.100
  Duration: 00:00:10.00, start: 0.000000, bitrate: 4119 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720, 4105 kb/s, 30 fps, 30 tbr, 15360 tbn, 30720 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 12 kb/s (default)
    Metadata:
      handler_name    : SoundHandler

Thank you all in advance!
Best,
Ram
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: 'ALSA buffer xrun' errors only when running as systemd

Nicolas George
Ram Shaffir (12020-07-02):
> In the last few weeks, I’m struggling to figure out the reason for why
> my ffmpeg command that works well when running in the console but has
> ALSA buffer xrun errors when it runs as a systemd service in RPI,
> until now I don’t know for sure where the problem is, is it in the
> alsa settings or in my ffmpeg command; I truly hope you’ll help me
> point me to the right solution!

ALSA xruns happen when ffmpeg does not read/write the audio device
frequently enough and the hardware buffer fills/dries up.

I suspect the difference lies in Linux giving different priorities to
processes detected as interactive and processes detected as background.

Regards,

--
  Nicolas George

_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".

signature.asc (849 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: 'ALSA buffer xrun' errors only when running as systemd

Ram Shaffir
> ALSA xruns happen when ffmpeg does not read/write the audio device frequently enough and the hardware buffer fills/dries up.

> I suspect the difference lies in Linux giving different priorities to processes detected as interactive and processes detected as background.

Thank you! I will try to find out how to set a higher priority for my service.
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".