Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ffmpeg segfault on concatenating m3u8 segments with ffmpeg version N-67181-g984d0b6e6f-static from pyffmpeg on Linux #20

Open
3 tasks done
FletcherD opened this issue Feb 14, 2024 · 8 comments
Assignees
Labels
external External library bug

Comments

@FletcherD
Copy link
Contributor

Bug Description

When running on Linux, while attempting to concatenate m3u8 segments using the bundled static ffmpeg from pyffmpeg, ffmpeg segfaults behind the scenes, causing fansly-downloader-ng to display:

WARNING | 19:10 || Skipping invalid item: Error running ffmpeg exit code -11: ffmpeg version N-67181-g984d0b6e6f-static https://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2023 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-libfribidi --enable-libass --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-libxvid --enable-libzimg
  libavutil      58. 25.100 / 58. 25.100
  libavcodec     60. 27.100 / 60. 27.100
  libavformat    60. 13.100 / 60. 13.100
  libavdevice    60.  2.101 / 60.  2.101
  libavfilter     9. 11.100 /  9. 11.100
  libswscale      7.  3.100 /  7.  3.100
  libswresample   4. 11.100 /  4. 11.100
  libpostproc    57.  2.100 / 57.  2.100

The ffmpeg command causing the segfault is something like:
/home/fletcher/.pyffmpeg/bin/ffmpeg -f concat -i /home/fletcher/fansly-downloader-ng/example_fansly/Timeline/Videos/_ffmpeg_concat_.ffc -c copy /home/fletcher/fansly-downloader-ng/example_fansly/Timeline/Videos/2024-01-30_at_05-51_id_123456789012345678.mp4

Which simply prints:
Segmentation fault (core dumped)

This appears to be an issue with the Linux static executable of ffmpeg that is bundled with pyffmpeg. Running the same command with a newer version of ffmpeg does not have the issue.
Therefore I have a workaround at #19 . With this fork ffmpeg.py will first check if the user already has an ffmpeg binary on the path, and if so, will use that binary rather than the one bundled with pyffmpeg. However this won't fix the issue for users who don't have ffmpeg installed, it seems we'll have to wait for the static build from https://johnvansickle.com/ffmpeg/ to be updated for that.

Environment Information

  • Operating System: Linux 6.2.0-36-generic I can download single or messages but not timelie] #37-Ubuntu x86_64
  • Fansly Downloader Version: v0.8.4
  • Fansly Downloader Type: Python script; running python fansly_downloader_ng.py directly using Python 3.11
  • Python packages: pyffmpeg==2.4.2.18.1
  • ffmpeg version: N-67181-g984d0b6e6f-static https://johnvansickle.com/ffmpeg/ (latest git master static build)
  • Specific creators name: Occurs with any creator

I have done the following:

@prof79
Copy link
Owner

prof79 commented Feb 14, 2024

Thanks a lot! v0.8.5 should come up shortly.

@prof79 prof79 added the external External library bug label Feb 14, 2024
@bssoul
Copy link

bssoul commented Feb 15, 2024

Thanks a lot! v0.8.5 should come up shortly.

Thank you, some of us aren't talented enough to do that so I will patiently wait for v0.8.5
You do great work, I want to say... thank you!

@prof79
Copy link
Owner

prof79 commented Mar 15, 2024

Hey @FletcherD , how should we proceed with this issue? Didn't check whether there is a fixed build available - but even if there was and since this might probably happen again with a future build - maybe I should just make this configurable "use/prefer locally installed ffmpeg"? Or I would have to somehow detect a segfault and use the fallback?

@FletcherD
Copy link
Contributor Author

Personally I think we should always use the user's ffmpeg if they have it. The static build will almost always be less up to date.

@prof79
Copy link
Owner

prof79 commented Mar 19, 2024

@FletcherD on my personal Windows machine I had the issue that an ImageMagick version also provides an older ffmpeg which totally screws up on concat commands and bails out.

Therefore I was wondering about the potential danger of an old ffmpegin the path for whatever reason, maybe this is more likely to happen on Windows.

@FletcherD
Copy link
Contributor Author

In that case, I'd say

  • Have a ffmpeg_path= config entry to point to the ffmpeg path
  • if it's empty (on first run), search for one: consider all ffmpeg on the path as well as in pyffmpeg and use the newest. Maybe have a minimum version
  • If ffmpeg terminates abnormally, show the user a message telling them to try a different ffmpeg_path, or maybe even letting them search for one interactively

I can look into some of it a bit later

@prof79
Copy link
Owner

prof79 commented Mar 19, 2024

👍Yeah it started with getting and evaluating the version ... I at first didn't want to go down the rabbit of capturing output and parsing version info out of it ... Also don't know, can abnormal termination/segfault be detected by exit code?

But take your time, let the dust settle and see whether v0.9.3 will now work stably with Fansly's security measures before making a considerable time investment.

@bssoul
Copy link

bssoul commented Mar 20, 2024

Are we set for testing 9.3? I got held up with something but I did get a new account ready. I'll do it tomorrow in am.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
external External library bug
Projects
None yet
Development

No branches or pull requests

3 participants