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

Add FFmpeg support to open video files #30

Merged
merged 19 commits into from
Jan 13, 2019
Merged

Commits on Jan 8, 2019

  1. Add FFmpeg support to open video files

    This fix adds a preliminary video file support (`VideoDataset`)
    by linking and using FFmpeg's libraries.
    
    The `video.VideoDataset` takes input of filename list, and
    generates outputs of RGB24 images (`uint8`) in `(height, width, 3)`.
    
    The reason to link against FFmpeg's libraries is because
    FFmpeg has a LGPL 2.1+ license.
    
    On Ubuntu 18.04, FFmpeg libraries consists of:
    ```
    libavformat.so.57
    libavcodec.so.57
    libavutil.so.55
    libswscale.so.4
    ```
    
    Because FFmpeg only guarantee's major version conpatibility,
    linking to a lower version (e.g., libavformat.so.54 on Ubuntu 14.04)
    may not work.
    
    To support multiple versions of Ubuntu, multiple copies of header file
    combined with linking to different versions of .so might be needed.
    
    It needs to be fully tested though and only limited major version should
    be supported.
    
    At the moment, only ffmpeg libraries in Ubuntu 18.04 are used.
    To install required libraries on Ubuntu 18.04:
    ```
    apt-get -y -qq install libavformat57 libavcodec57 libavutil55 libswscale4
    ```
    To build the pip package:
    ```
    bazel build -s --verbose_failures build_pip_pkg
    ```
    
    Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
    yongtang committed Jan 8, 2019
    Configuration menu
    Copy the full SHA
    8a88f15 View commit details
    Browse the repository at this point in the history
  2. Add python wrapper for video.VideoDataset

    Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
    yongtang committed Jan 8, 2019
    Configuration menu
    Copy the full SHA
    9a500e5 View commit details
    Browse the repository at this point in the history
  3. Add test case for video.VideoDataset

    Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
    yongtang committed Jan 8, 2019
    Configuration menu
    Copy the full SHA
    fdf7499 View commit details
    Browse the repository at this point in the history
  4. Add BUILD file for tensorflow_io.video

    Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
    yongtang committed Jan 8, 2019
    Configuration menu
    Copy the full SHA
    cd22417 View commit details
    Browse the repository at this point in the history
  5. Add ffmpeg n3.4.4 dependency

    Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
    yongtang committed Jan 8, 2019
    Configuration menu
    Copy the full SHA
    6dcdaa5 View commit details
    Browse the repository at this point in the history
  6. Update BUILD file to include video.VideoDataset

    Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
    yongtang committed Jan 8, 2019
    Configuration menu
    Copy the full SHA
    15b2c43 View commit details
    Browse the repository at this point in the history
  7. Disable -//tensorflow_io/video:video_py_test test on Ubuntu 14.04

    Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
    yongtang committed Jan 8, 2019
    Configuration menu
    Copy the full SHA
    1df47e2 View commit details
    Browse the repository at this point in the history
  8. Update ffmpeg to use stub .so files

    So that build could always succeed. In runtime system .so files will be used.
    
    Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
    yongtang committed Jan 8, 2019
    Configuration menu
    Copy the full SHA
    738b8ea View commit details
    Browse the repository at this point in the history
  9. Add Travis CI for Ubuntu 18.04, use docker run as Travis does not h…

    …ave Ubuntu 18.04 support directly.
    
    Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
    yongtang committed Jan 8, 2019
    Configuration menu
    Copy the full SHA
    d218d35 View commit details
    Browse the repository at this point in the history
  10. Disable sandboxed mode in bazel and use --spawn_strategy standalone

    Encountered quite some issues with
    ```
    Use --sandbox_debug to see verbose messages from the sandbox
    /usr/bin/ld.gold: error: cannot find libavformat.so.57
    /usr/bin/ld.gold: error: cannot find libavcodec.so.57
    /usr/bin/ld.gold: error: cannot find libavutil.so.55
    /usr/bin/ld.gold: error: cannot find libswscale.so.4
    collect2: error: ld returned 1 exit status
    Target //tensorflow_io/video:video_py_test failed to build
    ```
    
    Believe it is related to (or similiar):
    https://stackoverflow.com/questions/52386530/linker-fails-in-sandbox-when-running-through-bazel-but-works-when-sandboxed-comm?rq=1
    
    Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
    yongtang committed Jan 8, 2019
    Configuration menu
    Copy the full SHA
    a53ddf6 View commit details
    Browse the repository at this point in the history
  11. Use python as base vm image for Travis CI Ubuntu 18.04

    (By default Travis CI uses Ruby)
    
    Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
    yongtang committed Jan 8, 2019
    Configuration menu
    Copy the full SHA
    29bb7dc View commit details
    Browse the repository at this point in the history
  12. Only Enable Video on Travis CI for Ubuntu 18.04, as it is inside cont…

    …ainer
    
    Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
    yongtang committed Jan 8, 2019
    Configuration menu
    Copy the full SHA
    f26e4ee View commit details
    Browse the repository at this point in the history
  13. Add Ubuntu 16.04 support, by build separate so with ffmpeg 2.8

    Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
    yongtang committed Jan 8, 2019
    Configuration menu
    Copy the full SHA
    a113c69 View commit details
    Browse the repository at this point in the history
  14. Fix additional issue in ffmpeg 3.4 where cached packet should just ig…

    …nore error
    
    Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
    yongtang committed Jan 8, 2019
    Configuration menu
    Copy the full SHA
    bdb85d3 View commit details
    Browse the repository at this point in the history
  15. Add Ubuntu 14.04 support, with libav 9.20 built in.

    Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
    yongtang committed Jan 8, 2019
    Configuration menu
    Copy the full SHA
    f3884ae View commit details
    Browse the repository at this point in the history
  16. Add libav dependency and enable video test on Ubuntu 14.04

    Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
    yongtang committed Jan 8, 2019
    Configuration menu
    Copy the full SHA
    ccc8a20 View commit details
    Browse the repository at this point in the history
  17. Enable Ubuntu 16.04 for video.VideoDataset

    Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
    yongtang committed Jan 8, 2019
    Configuration menu
    Copy the full SHA
    a5cbf32 View commit details
    Browse the repository at this point in the history
  18. Defined a bazel rule of cc_import_library to only accepts system li…

    …brary
    
    and use `cc_import_library` rule to prevent including GPL code.
    
    Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
    yongtang committed Jan 8, 2019
    Configuration menu
    Copy the full SHA
    10a402d View commit details
    Browse the repository at this point in the history
  19. Reduce verbose logging output by bazel

    Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
    yongtang committed Jan 8, 2019
    Configuration menu
    Copy the full SHA
    4da4dd2 View commit details
    Browse the repository at this point in the history