Skip to content

(re)new plugin for video #406

Closed
Closed

Description

@almarklein

We currently have two formats for video. Avbin and ffmpeg. Avbin wraps a binary from 2012, so we should probably deprecate that. We have quite a bit of problems with the ffmpeg plugin, most notably the difficulty of retrieving the right fps and number of frames. In this issue I hope to get some ideas of what our options are ... please discuss.

  • In New Plugin for video based on PyAV (bindings to ffmpeg lib) #115 we suggested to use PyAv. But it's (now) basically conda-only, and I am reluctant to force ppl to use that.
  • Maybe we can help PyAv with automating the building of their binary wheels?
  • It has been suggested to use ffprobe to collect metadata about a video file. Although this adds another dependency, it's kinda part of ffmpeg, and maybe it can solve most our issues.
  • @hmaarrfk, you mentioned pyffmpeg, I see two of these on Github. Would it be worth depending on something like that? Or examine the code and improve our ffmpeg plugin based on what we learn?
  • Other ideas?

If anyone is eager to champion this effort, that would be great 👍 !

cc @hmaarrfk @kuchi @Zulko @ghisvail

Activity

  1. almarklein commented on Nov 6, 2018

    @almarklein
    MemberAuthor

    In terms of packaging, a library that wraps ffmpeg could included the binaries (the ones that imageio makes easy to download) in the binary wheels. It must be possible to create those wheels from a single OS (because the binaries are pre-build). That way installation for users is easy, and without any of that download() stuff. Plus Linux packagers are happy because they can take the sdist instead. Right @ghisvail ?

  2. hmaarrfk commented on Nov 7, 2018

    @hmaarrfk
    Contributor
  3. hmaarrfk commented on Nov 12, 2018

    @hmaarrfk
    Contributor

    Man, I didn't know that PyAv was so advanced. I got stuck on pyffmpeg getting arrays wrapped with swig. C is just really hard to wrap since it is so low level. I'm going to look at PyAv more closely.

  4. almarklein commented on Nov 12, 2018

    @almarklein
    MemberAuthor

    Swig would need knowledge of the underlying installed version of ffmpeg at compile time. Meaning conda is likely the only reliable way to ship it in binary form.

    I consider this a serious drawback ...

    I'm playing with the idea of spinning out our ffmpeg wrapper (i.e. calling the ffmpeg exe and send images over a pipe) into a separate package. The used method is not the fastest or easiests, but it does work with any ffmpeg version, making distribution much easier and flexible. By also making use of ffprobe, I hope we can overcome the limitations that currently bother us most (like getting fps and number of frames). We can push platform-specific wheels to pypi that include the binary exes (this is what I meant in my comment above).

  5. hmaarrfk commented on Nov 12, 2018

    @hmaarrfk
    Contributor

    I'm not sure there is a good pypi solution to these C dependencies. Rolling your own is a great stopgap solution, and definitely makes imageio "just work the first time", but makes things like security concerns problematic.

    Isn't imageio basically the ffmpeg wrapper that you are talking about? Why would you want to rebuild the infrastructure for that other project?

  6. almarklein commented on Nov 12, 2018

    @almarklein
    MemberAuthor

    Why would you want to rebuild the infrastructure for that other project?

    Because that new library can become an optional dependency of imageio. That way imageio itself can stay light, while that new lib can include the binaries (ffmpeg and ffprobe) in the dist. (BTW, Linux distros can package that lib without the binaries and make it use the system ffmpeg instead.)

    The workflow then becomes:

    • User installs imageio
    • User wants to use video, imageio gives error and hints to install this-new-lib
    • User does pip install this-new-lib
    • Bam, it works.

    Also, libs like @Zulko 's moviepy can depend on that lib instead of imageio, instead of relying on imageio and somehow have the user invoke imageio.plugins.ffmpeg.download().

  7. hmaarrfk commented on Nov 12, 2018

    @hmaarrfk
    Contributor

    So you want a pip installable ffmpeg. Sounds reasonable, but sounds difficult to get right with compiler restrictions.

  8. almarklein commented on Nov 13, 2018

    @almarklein
    MemberAuthor

    So you want a pip installable ffmpeg.

    Sort of. But I don't want pip to compile ffmpeg if that's what you meant. I want pip to install the Python code, which works with about any ffmpeg. Then provide binary wheels that include a precompiled ffmpeg (like these). Maybe not on Linux, because Linux users usually can/want to apt-install it.

  9. almarklein commented on Feb 5, 2019

    @almarklein
    MemberAuthor

    work in progress: #425

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions