Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I've been so frustrated that FFprobe functionality is not part of FFmpeg.

My app extracts screenshots from videos to create a beautiful gallery of videos. But even though I include FFmpeg already, I need a 50mb FFprobe executable to be bundled with my app just so that I can determine the width, height, duration, and fps of a video file!

What is it that FFprobe does that FFmpeg couldn't do with a few extra pieces of exposed API?

https://videohubapp.com/ - https://github.com/whyboris/Video-Hub-App

https://github.com/whyboris/Video-Hub-App/blob/772b25bbd4b41...



ffmpeg and ffprobe are built against the exact same set of libraries, so they could certainly be combined into a single program if the ffmpeg maintainers chose to do so.

Two possible options to reduce the size of your application:

(1) Instead of using ffprobe, just call "ffmpeg -i <filename>" without specifying an output file, then parse stderr:

    $ ffmpeg -i https://download.dolby.com/us/en/test-tones/dolby-atmos-trailer_amaze_1080.mp4 >/dev/null
    ffmpeg version 4.4.2 Copyright (c) 2000-2021 the FFmpeg developers
    . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
    Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'https://download.dolby.com/us/en/test-tones/dolby-atmos-trailer_amaze_1080.mp4':
      Metadata:
        major_brand     : isom
        minor_version   : 512
        compatible_brands: isomiso2avc1mp41
        encoder         : Lavf58.76.100
      Duration: 00:01:03.55, start: 0.000000, bitrate: 4537 kb/s
      Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, 5.1, fltp, 128 kb/s (default)
        Metadata:
          handler_name    : sound handler
          vendor_id       : [0][0][0][0]
      Stream #0:1(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 4404 kb/s, 24 fps, 24 tbr, 12288 tbn, 48 tbc (default)
        Metadata:
          handler_name    : video handler
          vendor_id       : [0][0][0][0]
    At least one output file must be specified
This is admittedly messy compared to parsing structured ffprobe output, but it does contain all the information you mentioned (assuming duration in centiseconds is sufficiently precise for your application).

(2) Link both ffmpeg and ffprobe dynamically, in which case they'll share all but a few hundred kilobytes of on-disk code.

For example, consider ffmpeg and ffprobe as installed from package repositories on a variety of systems:

ffmpeg 4.4.2 installed by MacPorts on macOS Monterey (x86_64):

    $ du -hA /opt/local/bin/ff{mpeg,probe}
    339K  /opt/local/bin/ffmpeg
    260K  /opt/local/bin/ffprobe

    $ diff -s <(otool -L /opt/local/bin/ffmpeg) <(otool -L /opt/local/bin/ffprobe)
    1c1
    < /opt/local/bin/ffmpeg:
    ---
    > /opt/local/bin/ffprobe:
    72d71
    <  /usr/lib/libobjc.A.dylib (compatibility version 1.0.0, current version 228.0.0)
ffmpeg 5.1.2 installed from RPM Fusion on Fedora 37 (x86_64):

    $ du -h /usr/bin/ff{mpeg,probe}
    284K  /usr/bin/ffmpeg
    176K  /usr/bin/ffprobe

    $ diff -s <(ldd /usr/bin/ffmpeg | awk '{ print $1 }') <(ldd /usr/bin/ffprobe | awk '{ print $1 }')
    Files /dev/fd/63 and /dev/fd/62 are identical
ffmpeg 4.3.5 installed from raspberrypi.org on Debian 11.6 (aarch64):

    $ du -h /usr/bin/ff{mpeg,probe}
    276K  /usr/bin/ffmpeg
    176K  /usr/bin/ffprobe

    $ diff -s <(ldd /usr/bin/ffmpeg | awk '{ print $1 }') <(ldd /usr/bin/ffprobe | awk '{ print $1 }')
    Files /dev/fd/63 and /dev/fd/62 are identical
MinGW-w64 ffmpeg 4.4.3 installed by MSYS2 on Windows 10 (x86_64):

    $ du -h /mingw64/bin/ff{mpeg,probe}.exe
    320K  /mingw64/bin/ffmpeg.exe
    184K  /mingw64/bin/ffprobe.exe

    $ diff -s <(Dependencies -depth 1 -modules /mingw64/bin/ffmpeg.exe | tail -n +2) <(Dependencies -depth 1 -modules /mingw64/bin/ffprobe.exe | tail -n +2)
    Files /dev/fd/63 and /dev/fd/62 are identical
("Dependencies" is Dependencies.exe from https://github.com/lucasg/Dependencies)


You are a superhero!

I'll explore these options <3

https://github.com/whyboris/Video-Hub-App




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: