Skip to content

Replace LIBAV with original FFMPEG #974

Closed

Description

@sgothel

Feature Request

While working on NVENC support #259
I have compared FFMPEG with LIBAV a little, backporting FFMPEG's NVENC implementation
to LIBAV.

Here I have discovered a few artifacts:

  1. FFMPEGs NVENC version is more up-to-date and closer to the Nvenc spec,
    LIBAVs version is sort of outdated.

  2. Most enhancements are being produced for FFMPEG first, then merely backported to LIBAV

  1. Above is also visible with the backporting, i.e. the format writer doesn't work properly using NVENC
  1. Reasons for Debian (and hence Ubuntu) to revert to the original FFMPEG

HandBrake version (e.g., 1.0.0)

Master branch

Example

Commit sgothel@0466852
as used for the NVENC feature in branch https://github.com/sgothel/HandBrake/tree/nvenc-encoder
(pull request #971)

I could easily replace LIBAV 12.2 with FFMPEG 3.4, however, one would need to
re-validated the many LIBAV patches for FFMPEG 3.4 - if they still apply.
A first attempt disclosed multiple rejections and this task surely needs some effort.

Work Assignment

I would volunteer performing this work, if the transition to FFMPEG is supported.

Activity

  1. galad87 commented on Nov 3, 2017

    @galad87
    Contributor

    I have nothing against switching to FFmpeg. Other developers opinions may not be the same as mine.

  2. added this to the 1.2.0 milestone on Nov 6, 2017
  3. sr55 commented on Nov 6, 2017

    @sr55
    Contributor

    We'll want to push 1.1 out the door (hopefully sooner rather than later) then we can look at what's involved in switching over in 1.2. We don't really want to rock the boat right now quite close to finishing up work that will allow us to release.

    1.2 can focus on decode/encode improvements as a key point.

    While personally, I'd rather stay with libav, they are falling behind in certain areas that interest us so I'm not going to object to a switch over. If we had more time ourselves to maintain and backport what we need, it might be a different story but that's not going to happen realistically.

  4. jstebbins commented on Nov 6, 2017

    @jstebbins
    Contributor

    I currently know of only one incompatibility between libav and ffmpeg. libav uses AV_CODEC_ID_SRT for SRT subtitles. ffmpeg uses AV_CODEC_ID_SUBRIP, even though they also have a define for AV_CODEC_ID_SRT. Since they have the define, HandBrake builds without error against ffmpeg. But it fails to recognize SRT subtitles.

    I wouldn't be surprised if there are more such problems waiting for us to discover.

    Some of our current libav patches already made it into libav git. And many of those have gotten into ffmpeg due to the libav merge effort ffmpeg continues. But we'll have to inspect the patches carefully because ffmpeg often decides to do things a little differently.

  5. sgothel commented on Nov 6, 2017

    @sgothel
    ContributorAuthor

    @jstebbins yes ofc, that would be one important task for the ffmpeg move.
    @sr55 how about creating a 1.2 branch and moving to ffmpeg on master .. or within its own branch?
    Then you could merge my branch and we could work from there.

  6. sgothel commented on Nov 6, 2017

    @sgothel
    ContributorAuthor

    Maybe you like to have a clean FFMPEG branch of mine to merge w/ NVENC changes on top?

  7. jstebbins commented on Nov 6, 2017

    @jstebbins
    Contributor

    An ffmpeg switch should be done as it's own PR. Any PR that needs to be built on top of an ffmpeg switch can rebase or merge with the ffmpeg switch PR as necessary.

  8. added a commit that references this issue on Nov 7, 2017
  9. sgothel commented on Nov 7, 2017

    @sgothel
    ContributorAuthor

    @jstebbins @sr55 I have re-packaged the work

  10. added 2 commits that reference this issue on Dec 26, 2017
  11. sgothel commented on Dec 26, 2017

    @sgothel
    ContributorAuthor

    @jstebbins I would commit on the swresample move 'as we go' within 2018, if that is fine with you.
    Background: We have identified that avresample is deprecated in ffmpeg and therefor code shall use swresample 'soon'.
    While it is debatable how high this priority is, it shall be done at some point in time.

  12. sgothel commented on Dec 26, 2017

    @sgothel
    ContributorAuthor

    Regarding the libav patches, see @cehoyos #981 (comment)

    A11 needs another look.

    A01-matroskaenc-pgs-duration.patch: Looks ok, sent to ffmpeg-devel
    A04-dv-eof.patch: In FFmpeg since September 2015
    A05-p10-output-support.patch: In FFmpeg since August 2016 (missing copyright btw)
    A06-edit-list-offset.patch: I don't know of open edit-list issues in FFmpeg, if you find them, please tell me!
    A09-mkv-block-ts-offset.patch: Merged into FFmpeg a month ago
    A10-mp4-aac-roll.patch: Something similar looking is in FFmpeg
    A11-elst-audio-pad.patch: Needs a bug report or a patch
    A13-mkv-fix-seek-crash.patch: Fixed in FFmpeg November 2016
    A14-aacenc-high-bitrate-crash.patch: Not relevant for FFmpeg (and fixed a long time ago)
    A17-mkv-rawvideo.patch: Fixed in June 2011
    A18-avi-broken-index.patch: Fixed in 2012
    A19-h264-refs.patch: FFmpeg-patch from 2011
    A20-hvc1-override.patch: In FFmpeg since June
    P01-solaris.patch: Looks hardly relevant
    P02-darwin-pic.patch: What's wrong with --enable-pic?

  13. 8 remaining items

  14. bradleysepos commented on Jan 12, 2018

    @bradleysepos
    Contributor

    HandBrake 1.1.0 is essentially done. We're trying to iron out a few graphical interface nits. See #833

  15. scaronni commented on May 16, 2018

    @scaronni

    Still getting the Subtitle codec 94212 is not supported error message with some UTF-8 subtitles even with the patch at https://trac.ffmpeg.org/ticket/6304

  16. jstebbins commented on May 16, 2018

    @jstebbins
    Contributor

    @scaronni you've found a separate issue. That trac ticket is about demuxing and decoding SRT subtitles. The issue you've found is muxing SSA subtitles. The mkv muxer is complaining because HandBrake uses AV_CODEC_ID_SSA which libav expects. But ffmpeg expects AV_CODEC_ID_ASS instead. So we need another modification to HandBrake to change AV_CODEC_ID_SSA to AV_CODEC_ID_ASS in libhb/muxavformat.c

  17. scaronni commented on May 17, 2018

    @scaronni

    ah, perfect, thank you. Will try that.

  18. scaronni commented on May 23, 2018

    @scaronni

    This seems to be working fine, thanks!

  19. bradleysepos commented on May 29, 2018

    @bradleysepos
    Contributor

    Merged FFmpeg 4.0 into master. See #1078 (comment) for some comments.

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

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions