Skip to content

Switch from Libav to FFmpeg. - #1078

Merged
bradleysepos merged 15 commits into
HandBrake:masterfrom
sgothel:ffmpeg
May 29, 2018
Merged

bradleysepos merged 15 commits into
HandBrake:masterfrom
sgothel:ffmpeg

Conversation

@sgothel

@sgothel sgothel commented Dec 26, 2017 •

Copy link
Copy Markdown
Contributor

Revising pull request #981 'FFMPEG #974: Use latest FFMPEG 3.4'

  • Based on ffmpeg 3.4.1 4.0
  • Splitting patch into two chunks for easier re-usage
  • Based upon more recent master commit

@sgothel

sgothel commented Jan 12, 2018

Copy link
Copy Markdown
Contributor Author

Added commits in ffmpeg branch, not showing here (yet). Hmm.

@sr55 sr55 added this to the 1.2.0 milestone Jan 14, 2018
@sr55

sr55 commented Apr 8, 2018

Copy link
Copy Markdown
Contributor

OK, that's 1.1.0 out the door... finally.

Do you mind re-basing and targeting 3.4.2 and I'll start testing

@bradleysepos

Copy link
Copy Markdown
Contributor

I will also test, thanks.

@sr55

sr55 commented Apr 24, 2018 •

Copy link
Copy Markdown
Contributor

Seem to be having problems finding pthreads with mingw builds :(

Compiles fine on Linux. Suspect your missing some required API changes for subtitles. ASS/SRT do not work.

Stream #0:16(spa): Subtitle: ass
Stream #0:17(swe): Subtitle: ass
[11:22:48] add_ffmpeg_subtitle: unknown subtitle stream type: 0x1780d
[11:22:48] add_ffmpeg_subtitle: unknown subtitle stream type: 0x1780d

Basic checks on Decode / Audio & Video Encode are working so steps in the right direction there.

@sr55
sr55 requested review from bradleysepos, jstebbins and sr55 April 24, 2018 18:25
@Nomis101

Copy link
Copy Markdown
Contributor

FFmpeg 4.0 ist out now, with lots of great enhancements HandBrake could benefit from:
https://www.ffmpeg.org/index.html#news

@sr55

sr55 commented Apr 24, 2018 •

Copy link
Copy Markdown
Contributor

We'll pull in 4.0 but just to keep it up-to-date but there's only 1 or 2 items on that list that might be usable in HandBrake. There is probably more bug fixes behind the scenes that are more useful than anything else.

HandBrake isn't going to expose the ffmpeg feature set. We only use a small fraction of what libav, nevermind ffmpeg does today.

@bradleysepos

Copy link
Copy Markdown
Contributor

I wonder if we should be enabling --enable-runtime-cpudetect?

@sr55 Are you getting an error regarding pthreads? --enable-pthreads is present, so it should be working.

@ghost

ghost commented Apr 25, 2018

Copy link
Copy Markdown

Would that mean that any testing so far on 3.4.1 was for nothing? I guess switch asap, but testers should keep in mind to also manage tests so you can easily run them again without too much work, even batch if possible.

@sr55

sr55 commented Apr 25, 2018

Copy link
Copy Markdown
Contributor

Not much testing done our end due to lack of time and the 1.1 release.

We don't have any testers. There is literally only a couple active devs with very little free time. So end-users using the nightly builds tend to be the guinea pigs for new features / changes.

Basically, we'll sanity check the things that we know are common / know are broken under ffmpeg versions of HandBrake under linux distros. If that all passes no reason to hold it back.

At his point, may as well goto 4 unless there are any serious known issues with it.

@cehoyos

cehoyos commented Apr 25, 2018

Copy link
Copy Markdown

@bradleysepos: No need to use --enable-runtime-cpudetect, it is the default and would have no effect on Handbrake. --enable-pthreads is also the default on platforms where it makes sense, not sure if it should be used on Windows where it is not the default.

Seeing an old comment: If you haven't removed --enable-zlib and --enable-bzlib, please do so, they make debugging more difficult.

Sven wrote he tested and fixed the subtitle issue...

@bradleysepos

Copy link
Copy Markdown
Contributor

Thanks @cehoyos. We build pthreads-win32 and --enable-pthreads with Libav currently. Hopefully @sr55 can clarify what threading issue he is having when he has some time.

We definitely need @jstebbins' input on which FFmpeg release to base on in the near term. If his intent is to allow system FFmpeg on Linux, FFmpeg 4 may be too new to require at this point.

@cehoyos

cehoyos commented Apr 26, 2018

Copy link
Copy Markdown

I don't think there is any sense in using an outdated release, note that Debian has already started to switch to FFmpeg 4.0, I cannot imagine a distribution with Handbrake 1.2 that does not contain FFmpeg 4.0 (or later).

@bradleysepos

Copy link
Copy Markdown
Contributor

Going forward, absolutely. But we’re supporting three Ubuntu LTS releases at the moment so we will have to think about whether we want to make the effort to support multiple versions or drop older distros sooner.

@sr55

sr55 commented Apr 26, 2018

Copy link
Copy Markdown
Contributor

@cehoyos
It looks like ffmpeg doesn't really do maintenance releases. They all seem to include new/changed functionality which does pose a bit of a problem since we want a known quantity, (i.e specific version of ffmpeg).

I.e It doesn't look like security releases are backported? (I suspect some distro's may do this but I can't see from the changelog if this is across the board)

From a support perspective, especially since we have so few devs and so little free time we want to have a single feature version of ffmpeg that works with any given HandBrake version.

We still have the option of bundling ffmpeg in our builds (Might have to for flatpak?). Distros may find their restricted on what versions of HandBrake they can include if they continue packaging. (I guess atleast it should be a little less broken than it is today!)

@sr55

sr55 commented Apr 26, 2018

Copy link
Copy Markdown
Contributor

@bradleysepos It's a build time problem. ffmpeg can't find pthreads when compiling under MinGW.

@bradleysepos

Copy link
Copy Markdown
Contributor

@sr55 Okay, thanks. When I get around to testing, I’ll make sure to look into that.

@cehoyos

cehoyos commented Apr 26, 2018

Copy link
Copy Markdown

@sr55: Not sure I understand: In the last twelve months, 27 FFmpeg maintenance releases were made. These are releases without any new or changed functionality, only security and regression fixes. Do you consider this a small number (as in "really no maintenance releases")? Or do feel that the reaction time to issues reported to our security mailing list is too slow? (Hint: Try to find an FFmpeg CVE that was opened before it was fixed in FFmpeg.)

Could you explain how you came to your conclusions? To the best of my knowledge, no distribution currently tries to backport security fixes themselves (those who tried in the past failed iirc), and this isn't necessary since several release series currently get security support, we follow this maintenance-only release plan since several years.

And sorry if the following sounds too aggressive: How would you call the maintenance support of your current supplier? Do you feel they are quickly fixing the security issues reported?

I don't understand your bundling issue: So far, you could only distribute bundled binaries (because for the known reasons, no distribution ships avconv). If you start to support a current FFmpeg release series (4.0), all distributions will pick your next release and ship it with their system libraries. You can still continue to ship bundled binaries (if you like), as you have to for Windows and OSX. Where is the problem?

@bradleysepos

bradleysepos commented Apr 26, 2018 •

Copy link
Copy Markdown
Contributor

@cehoyos Indeed, on occasion you come off aggressive. If we were mistaken about maintenance releases, 3 paragraphs and an underhanded swipe at Libav comes off more political than helpful.

We will continue to bundle FFmpeg for macOS and Windows as we have Libav. The real questions are whether John wants to use system FFmpeg on BSD/Linux and what FFmpeg versions are available for the distros and versions we support.

For instance, perhaps we move directly to FFmpeg 4 and drop old distro versions at that time. Or maybe we can special case HandBrake code where the FFmpeg API differs to make use of either 3.4.x or 4. None of this is an issue per se; it's more of a series of conversations we should have as we move forward.

@cehoyos

cehoyos commented Apr 26, 2018

Copy link
Copy Markdown

To make sure there is no misunderstanding between us: I tried hard to word my comment as kindly as possible while I find the claim FFmpeg does no security maintenance - well, let's say "surprising". (Sadly, you didn't answer my question.)

As said, I cannot understand your bundling issues: If you provide new Handbrake for old Linux distributions, I don't think it makes sense to link against old FFmpeg on these systems: The whole point in using new Handbrake would likely be lost.
Not moving to FFmpeg 4 right now seems like a bad idea to me, the special casing is likely possible but has no advantage for you (but a maintenance cost). But this is of course all your decision, I can only post my opinion, based on what I see others doing.

@mirh

mirh commented Apr 26, 2018

Copy link
Copy Markdown

https://github.com/FFmpeg/FFmpeg/blob/master/doc/APIchanges
You can read here how much of a deal older versions are to support, before deciding..

@bradleysepos

Copy link
Copy Markdown
Contributor

@cehoyos I appreciate your attempts at kindness. I think if you reread Scott's comments you'll hear a more inquisitive tone. Nobody at HandBrake is seeking to make false statements about FFmpeg; please forgive any oversights.

@mirh Thanks for the link!

@cehoyos

cehoyos commented Apr 26, 2018

Copy link
Copy Markdown

Thank you!

sgothel and others added 9 commits May 28, 2018 23:56
…codec_close(..)

Hence rename hb_avcodec_close -> hb_avcodec_free_context and pass the required ptr-ptr.
avcodec_free_context(..) ensures releasing of all resources attached to the context.
Fixes the build. Hardware acceleration should really be tested before we enable it, even in the nightly.
Use https and swap url order.
bradleysepos added a commit to sgothel/HandBrake that referenced this pull request May 29, 2018
@bradleysepos
bradleysepos merged commit dbe412e into HandBrake:master May 29, 2018
@bradleysepos bradleysepos changed the title FFMPEG #974: Use latest FFMPEG 3.4.1 Switch from Libav to FFmpeg. May 29, 2018
@bradleysepos

Copy link
Copy Markdown
Contributor

Merged FFmpeg 4.0 into master. Thanks everyone, especially @sgothel!

@sr55 When you have a chance, please upload the tarball. I removed --enable-pthreads, so please test threading and performance. Minor, we now link to mingw-w64's libbcrypt static lib, required by FFmpeg's seed generator; should be nothing additional needed there.

AudioToolbox, CoreImage, and VideoToolbox are currently disabled on Mac until we can add the proper frameworks to the Xcode project and these features (and those relying upon them) are tested.

@sr55

sr55 commented May 29, 2018

Copy link
Copy Markdown
Contributor

ffmpeg uploaded to our contrib mirror.

@ghost

ghost commented May 29, 2018 •

Copy link
Copy Markdown

That earlier point I made would only work if you guys merged the hotfixed 4.0 versus the very first release of 4.0 - which one did you pick? (or wait, they don't make hotfixes for the RELEASE channel or do they?, I better check myself before commenting)

@bradleysepos

Copy link
Copy Markdown
Contributor

@ghost

ghost commented May 29, 2018

Copy link
Copy Markdown

Thanks, that was fast 👍

@cehoyos

cehoyos commented May 29, 2018

Copy link
Copy Markdown

No release 4.0.1 was made so far because no important (security) issues were fixed since the 4.0 release.

I just realize now that a large number of commits that do not fix security issues (or regressions) was backported to 4.0, this usually means trouble;-(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

7 participants