[Libav-user] Request for Help: FFmpeg RTMP Muxer Error End of file w Overlay
Pierce Robbins
probbins at diamondkinetics.com
Wed Jul 9 19:59:38 EEST 2025
Hello,
Summary:
This FFmpeg error, "Error submitting a packet to the muxer: End of file,"
occurs during RTMP stream transcoding when an overlay is applied. The issue
is reproducible with image2 or rawvideo overlay inputs, appearing
intermittently between 5 minutes and 8+ hours of streaming, not at startup.
The error originates in `fftools/ffmpeg_mux.c:write_packet()` and traces
back to `libavformat/librtmp.c:RTMP_write()`. This function requires a size
argument greater than 11 bytes, but the error triggers when a small FLV
packet (1-4 bytes) is passed. The source of these small packets is
currently unknown, though custom logging indicates the RTMP connection
remains active. The RTMP source is a Linux machine with a stable fiber
optic internet connection.
System:
-
ffmpeg n7.1.1
-
OS Distribution: Ubuntu 22.04.5 LTS (Jammy)
-
Kernel Version: 5.15.0-130-generic
-
Kernel Build: #140-Ubuntu SMP Wed Dec 18 17:59:53 UTC 2024
-
Architecture: x86_64
Error: “Error submitting a packet to the muxer: End of file”
Raised: fftools/ffmpeg_mux.c:write_packet:239
Source: libavformat/librtmp.c:RTMP_write:206
-
call to RTMP_write() returns 0 because the size argument is less that 11
bytes
-
I have seen the size arg anywhere from 1-4 bytes throughout testing
-
The write fails but RTMP connection still appears to be active
Command:
ffmpeg -hide_banner -y \
-f flv -i rtmp://<host>:<port>/<app>/<stream_key> \
-f image2 -framerate 30 -stream_loop -1 -i
/Volumes/<ramdisk_name>/<image_file>.bmp \
-filter_complex "[0:v][1:v] overlay=(main_w-overlay_w)/2:0 [vout]" \
-map "[vout]" -map 0:a \
-c:v libx264 -preset veryfast -b:v 2200K \
-c:a aac -b:a 96K \
-max_muxing_queue_size 8192 \
-f flv rtmp://<host>:<port>/<app>/<stream_key>
*Terminal:*
root at vengine-d0-002:~# ffmpeg -hide_banner -y \
-f flv -i rtmp://<host>:<port>/<app>/<stream_key> \
-f image2 -framerate 30 -stream_loop -1 -i
/Volumes/ramdisk/olay-png/to_nimble.bmp \
-filter_complex "[0:v][1:v] overlay=(main_w-overlay_w)/2:0 [vout]" \
-map "[vout]" -map 0:a \
-c:v libx264 -preset veryfast -b:v 2200K \
-c:a aac -b:a 96K \
-max_muxing_queue_size 8192 \
-f flv rtmp://<host>:<port>/<app>/<stream_key>
Metadata:
duration 0.00
width 1280.00
height 720.00
videodatarate 2441.41
framerate 30.00
videocodecid 7.00
audiodatarate 125.00
audiosamplerate 44100.00
audiosamplesize 16.00
stereo TRUE
audiocodecid 10.00
encoder Lavf58.76.100
filesize 0.00
Input #0, flv, from 'rtmp://<host>:<port>/<app>/<stream_key>':
Metadata:
encoder : Lavf58.76.100
Duration: 00:00:00.00, start: 7806.432000, bitrate: N/A
Stream #0:0: Audio: aac (LC), 44100 Hz, stereo, fltp, 128 kb/s
Stream #0:1: Video: h264 (High), yuv420p(progressive), 1280x720 [SAR 1:1
DAR 16:9], 2500 kb/s, 30 fps, 30 tbr, 1k tbn
Input #1, image2, from '/Volumes/ramdisk/olay-png/to_nimble.bmp':
Duration: 00:00:00.03, start: 0.000000, bitrate: N/A
Stream #1:0: Video: bmp, bgra, 1280x720, 30 fps, 30 tbr, 30 tbn
Stream mapping:
Stream #0:1 (h264) -> overlay
Stream #1:0 (bmp) -> overlay
overlay:default -> Stream #0:0 (libx264)
Stream #0:0 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[libx264 @ 0x7fae13dbaec0] using SAR=1/1
[libx264 @ 0x7fae13dbaec0] using cpu capabilities: MMX2 SSE2Fast SSSE3
SSE4.2 AVX FMA3 BMI2 AVX2 AVX512
[libx264 @ 0x7fae13dbaec0] profile High, level 3.1, 4:2:0, 8-bit
[libx264 @ 0x7fae13dbaec0] 264 - core 164 r3108 31e19f9 - H.264/MPEG-4 AVC
codec - Copyleft 2003-2023 - http://www.videolan.org/x264.html - options:
cabac=1 ref=1 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=2 psy=1
psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=1
cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=12
lookahead_threads=4 sliced_threads=0 nr=0 decimate=1 interlaced=0
bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1
b_bias=0 direct=1 weightb=1 open_gop=0 weightp=1 keyint=250 keyint_min=25
scenecut=40 intra_refresh=0 rc_lookahead=10 rc=abr mbtree=1 bitrate=2200
ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, flv, to 'rtmp://<host>:<port>/<app>/<stream_key>':
Metadata:
encoder : Lavf61.7.100
Stream #0:0: Video: h264 ([7][0][0][0] / 0x0007), yuv420p(tv,
progressive), 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 2200 kb/s, 30 fps, 1k tbn
Metadata:
encoder : Lavc61.19.101 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/2200000 buffer size: 0 vbv_delay: N/A
Stream #0:1: Audio: aac (LC) ([10][0][0][0] / 0x000A), 44100 Hz, stereo,
fltp, 96 kb/s
Metadata:
encoder : Lavc61.19.101 aac
[vost#0:0/libx264 @ 0x7fae14066080] Error submitting a packet to the muxer:
End of filed=1.29x
[flv @ 0x7fae13e4e580] Failed to update header with correct duration.
[flv @ 0x7fae13e4e580] Failed to update header with correct filesize.
[out#0/flv @ 0x7fae14069100] Error writing trailer: End of file
[out#0/flv @ 0x7fae14069100] Error closing file: End of file
[out#0/flv @ 0x7fae14069100] video:1599KiB audio:3KiB subtitle:0KiB other
streams:0KiB global headers:0KiB muxing overhead: 0.706515%
frame= 228 fps= 30 q=-1.0 Lsize= 1613KiB time=00:00:09.46
bitrate=1396.2kbits/s speed=1.24x
[libx264 @ 0x7fae13dbaec0] frame I:2 Avg QP:10.03 size:116327
[libx264 @ 0x7fae13dbaec0] frame P:76 Avg QP:11.89 size: 18555
[libx264 @ 0x7fae13dbaec0] frame B:186 Avg QP:16.22 size: 2018
[libx264 @ 0x7fae13dbaec0] consecutive B-frames: 0.8% 0.0% 47.7% 51.5%
[libx264 @ 0x7fae13dbaec0] mb I I16..4: 67.0% 0.5% 32.4%
[libx264 @ 0x7fae13dbaec0] mb P I16..4: 1.3% 0.0% 0.8% P16..4: 7.8%
1.0% 1.8% 0.0% 0.0% skip:87.3%
[libx264 @ 0x7fae13dbaec0] mb B I16..4: 0.0% 0.0% 0.0% B16..8: 0.7%
0.2% 0.3% direct: 0.6% skip:98.1% L0:40.9% L1:38.2% BI:20.8%
[libx264 @ 0x7fae13dbaec0] final ratefactor: 6.43
[libx264 @ 0x7fae13dbaec0] 8x8 transform intra:0.6% inter:12.0%
[libx264 @ 0x7fae13dbaec0] coded y,uvDC,uvAC intra: 33.2% 31.2% 30.0%
inter: 2.2% 2.3% 1.5%
[libx264 @ 0x7fae13dbaec0] i16 v,h,dc,p: 81% 18% 1% 0%
[libx264 @ 0x7fae13dbaec0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 30% 24% 26% 3%
4% 3% 5% 3% 3%
[libx264 @ 0x7fae13dbaec0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 31% 20% 12% 5%
5% 7% 6% 7% 6%
[libx264 @ 0x7fae13dbaec0] i8c dc,h,v,p: 57% 20% 20% 2%
[libx264 @ 0x7fae13dbaec0] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x7fae13dbaec0] kb/s:1834.61
[aac @ 0x7fae13dbbe80] Qavg: 65536.000
Conversion failed!
Any insight is greatly appreciated!
Best,
Pierce
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20250709/a7190629/attachment.htm>
More information about the Libav-user
mailing list