Skip to content

Instantly share code, notes, and snippets.

@wjkoh
Last active June 17, 2025 07:59
Show Gist options
  • Save wjkoh/76e7fffa2cbe4e6e7190a8077a8ea2bf to your computer and use it in GitHub Desktop.
Save wjkoh/76e7fffa2cbe4e6e7190a8077a8ea2bf to your computer and use it in GitHub Desktop.
ffprobe: How to get the audio and video format and duration from a file
#!/usr/bin/env bash
# Use https://jqlang.org/
ffprobe -i test.ogg -show_format -output_format json | jq
# Use https://fx.wtf/
ffprobe -i test.ogg -show_format -output_format json | fx
@wjkoh
Copy link
Author

wjkoh commented Jun 17, 2025

The following is a sample output from stdout. The duration is in seconds:

{
  "format": {
    "filename": "test.ogg",
    "nb_streams": 1,
    "nb_programs": 0,
    "nb_stream_groups": 0,
    "format_name": "ogg",
    "format_long_name": "Ogg",
    "start_time": "0.000000",
    "duration": "43.450454",
    "size": "695512",
    "bit_rate": "128056",
    "probe_score": 100
  }
}

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