Opened 18 months ago

Closed 18 months ago

Last modified 18 months ago

#10013 closed defect (needs_more_info)

[regression] `ffmpeg` 5.0.1 crashes when using domain in URL when uploading to RTMP endpoint

Reported by: Jesús Leganés-Combarro Owned by:
Priority: important Component: undetermined
Version: unspecified Keywords: RTMP crash regression
Cc: Jesús Leganés-Combarro Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:

On ffmpeg 5.0.1 static from https://github.com/eugeneware/ffmpeg-static/releases/tag/b5.0.1 (originally from https://johnvansickle.com/ffmpeg/), when streaming to a RTMP endpoint using a domain as host name (in this case localhost) it crash with a SEGFAULT signal, generating a core dump. OTOH, when using an IP instead, it works flawlessly and can stream to the server. I have also check it with version 4.4.2-0ubuntu0.22.04.1 from Ubuntu repositories, and it doesn't crash when using both IP and domain (it fails in both case because I didn't have a server to fully test as with 5.0.1 version, but in neither case they crashed), so that leads me to think it's a regression, not sure if in RTMP uploader component, or on URL parser.

How to reproduce:

% node_modules/ffmpeg-static/ffmpeg      -re      -f lavfi        -i smptebars=rate=30:size=640x360      -f lavfi        -i sine=frequency=1000      -vf "drawtext=text=\'%{pts:hms}\':rate=30:x=(w-tw)/2:y=(h-lh)/2:fontsize=48:fontcolor=white:box=1:boxcolor=black"        -vcodec libx264        -profile:v baseline        -pix_fmt yuv420p        -preset ultrafast        -tune zerolatency        -crf 28      -acodec aac      -f flv        rtmp://localhost:1935
ffmpeg version 5.0.1-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 8 (Debian 8.3.0-6)

Attachments (4)

ffmpeg-20221107-125400.log (5.7 KB ) - added by Jesús Leganés-Combarro 18 months ago.
ffmpeg-5.0.1-localhost_fails.log (6.2 KB ) - added by Jesús Leganés-Combarro 18 months ago.
ffmpeg-4.4.2-localhost_succeed.log (6.2 KB ) - added by Jesús Leganés-Combarro 18 months ago.
ffmpeg-5.0.1-localhost_report.log (6.2 KB ) - added by Jesús Leganés-Combarro 18 months ago.

Download all attachments as: .zip

Change History (15)

by Jesús Leganés-Combarro, 18 months ago

Attachment: ffmpeg-20221107-125400.log added

by Jesús Leganés-Combarro, 18 months ago

by Jesús Leganés-Combarro, 18 months ago

by Jesús Leganés-Combarro, 18 months ago

comment:1 by Carl Eugen Hoyos, 18 months ago

Keywords: url removed
Priority: normalimportant

Please test current FFmpeg git head and report back.

comment:2 by Jesús Leganés-Combarro, 18 months ago

Please test current FFmpeg git head and report back.

I don't have binaries for the latest version. Just to confirm, are you asking about download latest version from git and compile it myself? Yes, I think can try to do it...

comment:3 by Carl Eugen Hoyos, 18 months ago

In an ideal world you would compile yourself but using a precompiled binary is a useful alternative.

comment:4 by Jesús Leganés-Combarro, 18 months ago

I've simplified the command (I did it this way to don't need to deal with libx264 library on the custom compilation), and with prebuild image of 5.0.1-static still fails, so it's easier to replicate:

piranna@ThinkPad-T16:/run/user/1000/LL-HLS-streamer_bttf$ node_modules/ffmpeg-static/ffmpeg -re -f lavfi -i sine=frequency=1000 -acodec aac -f flv rtmp://localhost:1935 -v 9 -loglevel 99
ffmpeg version 5.0.1-static https://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2022 the FFmpeg developers

built with gcc 8 (Debian 8.3.0-6)
configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg
libavutil 57. 17.100 / 57. 17.100
libavcodec 59. 18.100 / 59. 18.100
libavformat 59. 16.100 / 59. 16.100
libavdevice 59. 4.100 / 59. 4.100
libavfilter 8. 24.100 / 8. 24.100
libswscale 6. 4.100 / 6. 4.100
libswresample 4. 3.100 / 4. 3.100
libpostproc 56. 3.100 / 56. 3.100

Splitting the commandline.
Reading option '-re' ... matched as option 're' (read input at native frame rate; equivalent to -readrate 1) with argument '1'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'lavfi'.
Reading option '-i' ... matched as input url with argument 'sine=frequency=1000'.
Reading option '-acodec' ... matched as option 'acodec' (force audio codec ('copy' to copy stream)) with argument 'aac'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'flv'.
Reading option 'rtmp://localhost:1935' ... matched as output url.
Reading option '-v' ... matched as option 'v' (set logging level) with argument '9'.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument '99'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set logging level) with argument 9.
Successfully parsed a group of options.
Parsing a group of options: input url sine=frequency=1000.
Applying option re (read input at native frame rate; equivalent to -readrate 1) with argument 1.
Applying option f (force format) with argument lavfi.
Successfully parsed a group of options.
Opening an input file: sine=frequency=1000.
detected 16 logical cores
[Parsed_sine_0 @ 0x6f0e100] Setting 'frequency' to value '1000'
[AVFilterGraph @ 0x6f0c340] query_formats: 2 queried, 3 merged, 0 already done, 0 delayed
[lavfi @ 0x6f0b7c0] All info found
[lavfi @ 0x6f0b7c0] stream 0: start_time: 0 duration: NOPTS
[lavfi @ 0x6f0b7c0] format: start_time: 0 duration: NOPTS (estimate from bit rate) bitrate=705 kb/s
Input #0, lavfi, from 'sine=frequency=1000':

Duration: N/A, start: 0.000000, bitrate: 705 kb/s
Stream #0:0, 1, 1/44100: Audio: pcm_s16le, 44100 Hz, mono, s16, 705 kb/s

Successfully opened the file.
Parsing a group of options: output url rtmp://localhost:1935.
Applying option acodec (force audio codec ('copy' to copy stream)) with argument aac.
Applying option f (force format) with argument flv.
Successfully parsed a group of options.
Opening an output file: rtmp://localhost:1935.
[rtmp @ 0x6f258c0] No default whitelist set
[tcp @ 0x6f25fc0] No default whitelist set
Violación de segmento (`core' generado)

I've compiled release/5.1 branch and executed this simplified command, and with version 5.1.1 it's working, so not sure if it got fixed, or it's some issue regarding the compilation of the static binary:

piranna@ThinkPad-T16:~/Trabajo/ffmpeg$ ./ffmpeg -re -f lavfi -i sine=frequency=1000 -acodec aac -f flv rtmp://localhost:1935 -v 9 -loglevel 99
ffmpeg version n5.1.2-7-ga6e26053c2 Copyright (c) 2000-2022 the FFmpeg developers

built with gcc 11 (Ubuntu 11.3.0-1ubuntu1~22.04)
configuration:
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

Splitting the commandline.
Reading option '-re' ... matched as option 're' (read input at native frame rate; equivalent to -readrate 1) with argument '1'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'lavfi'.
Reading option '-i' ... matched as input url with argument 'sine=frequency=1000'.
Reading option '-acodec' ... matched as option 'acodec' (force audio codec ('copy' to copy stream)) with argument 'aac'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'flv'.
Reading option 'rtmp://localhost:1935' ... matched as output url.
Reading option '-v' ... matched as option 'v' (set logging level) with argument '9'.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument '99'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set logging level) with argument 9.
Successfully parsed a group of options.
Parsing a group of options: input url sine=frequency=1000.
Applying option re (read input at native frame rate; equivalent to -readrate 1) with argument 1.
Applying option f (force format) with argument lavfi.
Successfully parsed a group of options.
Opening an input file: sine=frequency=1000.
detected 16 logical cores
[Parsed_sine_0 @ 0x559914f8b040] Setting 'frequency' to value '1000'
[AVFilterGraph @ 0x559914f89200] query_formats: 2 queried, 3 merged, 0 already done, 0 delayed
[lavfi @ 0x559914f88500] All info found
[lavfi @ 0x559914f88500] stream 0: start_time: 0 duration: NOPTS
[lavfi @ 0x559914f88500] format: start_time: 0 duration: NOPTS (estimate from bit rate) bitrate=705 kb/s
Input #0, lavfi, from 'sine=frequency=1000':

Duration: N/A, start: 0.000000, bitrate: 705 kb/s
Stream #0:0, 1, 1/44100: Audio: pcm_s16le, 44100 Hz, mono, s16, 705 kb/s

Successfully opened the file.
Parsing a group of options: output url rtmp://localhost:1935.
Applying option acodec (force audio codec ('copy' to copy stream)) with argument aac.
Applying option f (force format) with argument flv.
Successfully parsed a group of options.
Opening an output file: rtmp://localhost:1935.
[rtmp @ 0x559914fa2700] No default whitelist set
[tcp @ 0x559914fa1b00] No default whitelist set
[tcp @ 0x559914fa1b00] Original list of addresses:
[tcp @ 0x559914fa1b00] Address 127.0.0.1 port 1935
[tcp @ 0x559914fa1b00] Interleaved list of addresses:
[tcp @ 0x559914fa1b00] Address 127.0.0.1 port 1935
[tcp @ 0x559914fa1b00] Starting connection attempt to 127.0.0.1 port 1935
[tcp @ 0x559914fa1b00] Connection attempt to 127.0.0.1 port 1935 failed: Connection refused
[tcp @ 0x559914fa1b00] Connection to tcp://localhost:1935?tcp_nodelay=0 failed: Connection refused
[rtmp @ 0x559914fa2700] Cannot open connection tcp://localhost:1935?tcp_nodelay=0
rtmp://localhost:1935: Connection refused

The diff on the outputs are these lines:

[tcp @ 0x559914fa1b00] Original list of addresses:
[tcp @ 0x559914fa1b00] Address 127.0.0.1 port 1935
[tcp @ 0x559914fa1b00] Interleaved list of addresses:
[tcp @ 0x559914fa1b00] Address 127.0.0.1 port 1935
[tcp @ 0x559914fa1b00] Starting connection attempt to 127.0.0.1 port 1935
[tcp @ 0x559914fa1b00] Connection attempt to 127.0.0.1 port 1935 failed: Connection refused
[tcp @ 0x559914fa1b00] Connection to tcp://localhost:1935?tcp_nodelay=0 failed: Connection refused
[rtmp @ 0x559914fa2700] Cannot open connection tcp://localhost:1935?tcp_nodelay=0
rtmp://localhost:1935: Connection refused

So it seems the issue happens when doing the conversion from the domain to the IP. Any clue what could be happening? How can we proceed from here?

comment:5 by Jesús Leganés-Combarro, 18 months ago

I have tested with latest static prebuild (5.1.1-static, https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz) and it's also crashing :-/

piranna@ThinkPad-T16:/run/user/1000/LL-HLS-streamer_bttf$ ./ffmpeg -re -f lavfi -i sine=frequency=1000 -acodec aac -f flv rtmp://localhost:1935 -v 9 -loglevel 99
ffmpeg version 5.1.1-static https://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2022 the FFmpeg developers

built with gcc 8 (Debian 8.3.0-6)
configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg
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

Splitting the commandline.
Reading option '-re' ... matched as option 're' (read input at native frame rate; equivalent to -readrate 1) with argument '1'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'lavfi'.
Reading option '-i' ... matched as input url with argument 'sine=frequency=1000'.
Reading option '-acodec' ... matched as option 'acodec' (force audio codec ('copy' to copy stream)) with argument 'aac'.
Reading option '-f' ... matched as option 'f' (force format) with argument 'flv'.
Reading option 'rtmp://localhost:1935' ... matched as output url.
Reading option '-v' ... matched as option 'v' (set logging level) with argument '9'.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument '99'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option v (set logging level) with argument 9.
Successfully parsed a group of options.
Parsing a group of options: input url sine=frequency=1000.
Applying option re (read input at native frame rate; equivalent to -readrate 1) with argument 1.
Applying option f (force format) with argument lavfi.
Successfully parsed a group of options.
Opening an input file: sine=frequency=1000.
detected 16 logical cores
[Parsed_sine_0 @ 0x5e8e100] Setting 'frequency' to value '1000'
[AVFilterGraph @ 0x5e8c340] query_formats: 2 queried, 3 merged, 0 already done, 0 delayed
[lavfi @ 0x5e8b7c0] All info found
[lavfi @ 0x5e8b7c0] stream 0: start_time: 0 duration: NOPTS
[lavfi @ 0x5e8b7c0] format: start_time: 0 duration: NOPTS (estimate from bit rate) bitrate=705 kb/s
Input #0, lavfi, from 'sine=frequency=1000':

Duration: N/A, start: 0.000000, bitrate: 705 kb/s
Stream #0:0, 1, 1/44100: Audio: pcm_s16le, 44100 Hz, mono, s16, 705 kb/s

Successfully opened the file.
Parsing a group of options: output url rtmp://localhost:1935.
Applying option acodec (force audio codec ('copy' to copy stream)) with argument aac.
Applying option f (force format) with argument flv.
Successfully parsed a group of options.
Opening an output file: rtmp://localhost:1935.
[rtmp @ 0x5ea5740] No default whitelist set
[tcp @ 0x5ea4a80] No default whitelist set
Violación de segmento (`core' generado)

comment:6 by Jesús Leganés-Combarro, 18 months ago

https://johnvansickle.com/ffmpeg/release-readme.txt

otes: A limitation of statically linking glibc is the loss of DNS resolution. Installing

nscd through your package manager will fix this.

So, after installing nscd package (sudo apt install nscd), static build is not crashing anymore :-( It seems to me "maybe" when ffmpeg does a DNS resolution, it's being returned an unmanaged value (probably a null pointer?) and that's why the crash and core dump is being generated. Does it makes sense?

comment:7 by Carl Eugen Hoyos, 18 months ago

Resolution: needs_more_info
Status: newclosed

Please reopen this ticket if you can test with current FFmpeg git head.

comment:8 by Jesús Leganés-Combarro, 18 months ago

Please reopen this ticket if you can test with current FFmpeg git head.

I can do it, just only would need to know what's the actual ffmpeg git development branch (there are several ones and I'm getting a bit lost... master? releases/5.1?), and if there's any special configuration to build a static binary, or if it's just enough to use gcc instructions to generate it.

comment:9 by Carl Eugen Hoyos, 18 months ago

I know of only one development branch, builds exist to the best of my knowledge.

comment:10 by Jesús Leganés-Combarro, 18 months ago

But, what branch is it? I see no develop or similar ones...

piranna@ThinkPad-T16:~/Trabajo/ffmpeg$ git branch -a

master

  • release/5.1 remotes/origin/HEAD -> origin/master remotes/origin/master remotes/origin/oldabi remotes/origin/release/0.10 remotes/origin/release/0.11 remotes/origin/release/0.5 remotes/origin/release/0.6 remotes/origin/release/0.7 remotes/origin/release/0.8 remotes/origin/release/0.9 remotes/origin/release/1.0 remotes/origin/release/1.1 remotes/origin/release/1.2 remotes/origin/release/2.0 remotes/origin/release/2.1 remotes/origin/release/2.2 remotes/origin/release/2.3 remotes/origin/release/2.4 remotes/origin/release/2.5 remotes/origin/release/2.6 remotes/origin/release/2.7 remotes/origin/release/2.8 remotes/origin/release/3.0 remotes/origin/release/3.1 remotes/origin/release/3.2 remotes/origin/release/3.3 remotes/origin/release/3.4 remotes/origin/release/4.0 remotes/origin/release/4.1 remotes/origin/release/4.2 remotes/origin/release/4.3 remotes/origin/release/4.4 remotes/origin/release/5.0 remotes/origin/release/5.1

comment:11 by Carl Eugen Hoyos, 18 months ago

remotes/origin/master

Note: See TracTickets for help on using tickets.