Benutzer-Werkzeuge

Webseiten-Werkzeuge


ffprobe

Dies ist eine alte Version des Dokuments!


ffprobe

> ffprobe -i Film.wmv -show_format
> ffprobe -i Film.wmv -show_packets
> ffprobe -i Film.wmv -show_streams

Zum auslesen der Video-Eigenschaften ist mediainfo deutlich besser geeignet! Es kann auch den Scan-Type (Progressive oder Interlaced) mit einer Ausnahme (manchmal gibt es anstelle von 50p, 50i aus) recht gut erkennen.

Video-Eigenschaften auslesen

Die wichtigsten Infos kann man mit diesem Kommando auslesen:

ffprobe Film.wmv
...
  Duration: 00:02:10.00, start: 0.000000, bitrate: 442 kb/s
  Stream #0.0(heb): Audio: wmav2, 22050 Hz, 1 channels, s16, 16 kb/s
  Stream #0.1(heb): Video: wmv3 (Main), yuv420p, 640x480, 413 kb/s, 20 tbr, 1k tbn, 1k tbc

Manchmal wird direkt vor "tbr" auch noch extra "fps" aufgeführt.

FFmpeg verwendet drei verschiedene Zeitangaben:

tbn = the time base in AVStream that has come from the container
tbc = the time base in AVCodecContext for the codec used for a particular stream
tbr = tbr is guessed from the video stream and is the value users want to see when they look for the video frame rate
25 fps  - Bilder/Sekunde
25 tbr  - geratene Bildwiederholrate des Datenstromes
90k tbn - Zeitbasis des AV-Kontainers
50 tbc  - Zeitbasis im AV-Kodec-Kontext

Also ist die Angabe "tbr" im allgemeinen mit "fps" gleichzusetzen.

Man kann sich die Infos auch in einem anderen Format ausgeben lassen. Eines, welches besser maschinenlesbar ist:

> ffprobe -i Film.wmv -show_streams 2>/dev/null
[STREAM]
index=0
codec_name=wmav2
codec_long_name=Windows Media Audio 2
codec_type=audio
codec_time_base=0/1
codec_tag_string=a[1][0][0]
codec_tag=0x0161
sample_rate=22050.000000 
channels=1
bits_per_sample=0
r_frame_rate=0/0
avg_frame_rate=250/81
time_base=1/1000
start_time=0.000000 
duration=130.000000 
TAG:language=heb
[/STREAM]
[STREAM]
index=1
codec_name=wmv3
codec_long_name=Windows Media Video 9
codec_type=video
codec_time_base=1/1000
codec_tag_string=WMV3
codec_tag=0x33564d57
width=640
height=480
has_b_frames=0
pix_fmt=yuv420p
r_frame_rate=20/1
avg_frame_rate=0/0
time_base=1/1000
start_time=0.000000 
duration=130.000000 
TAG:language=heb
[/STREAM]
> ffprobe -show_streams Film.mpg 2>/dev/null | sed 's/ /$/g' | tr -s '\n' ' ' | sed 's# \[/STREAM\]# [/STREAM]|#g' | tr -s '|' '\n' | fgrep codec_type=video | tr -s ' ' '\n' | sed 's/[$]/ /g' | egrep 'codec_time_base=|_frame_rate=|time_base='
codec_time_base=1/50
r_frame_rate=25/1
avg_frame_rate=25/1
time_base=1/90000

weitere Infos kann man sich mit diesem Kommando anzeigen lassen:

> ffprobe -show_format Film.wmv 2>/dev/null
[FORMAT]
filename=Film.wmv
nb_streams=2
format_name=asf
format_long_name=ASF format
start_time=0.000000 
duration=130.000000 
size=7197119.000000 
bit_rate=442899.000000 
TAG:WMFSDKVersion=10.00.00.3802
TAG:WMFSDKNeeded=0.0.0.0000
TAG:IsVBR=0
[/FORMAT]
> ffprobe -show_format Film.mpg 2>/dev/null
[FORMAT]
filename=Du_bist_was_Du_isst.mpg
nb_streams=3
format_name=mpeg
format_long_name=MPEG-PS format
start_time=0.287267
duration=0.928000
size=4992397312.000000
bit_rate=-2147483648.000000
[/FORMAT]
> ffprobe -show_packets Film.mpg 2>/dev/null | fgrep stream_index= | head -n1000 | sort | uniq
stream_index=0
stream_index=1
stream_index=2

Show Streams

> ffprobe -v error -probesize 9223372036G -analyzeduration 9223372036G -show_streams -i "${1}"
[STREAM]
index=0
codec_name=mpeg2video
codec_long_name=MPEG-2 video
profile=Main
codec_type=video
codec_tag_string=[0][0][0][0]
codec_tag=0x0000
width=720
height=576
coded_width=0
coded_height=0
closed_captions=0
film_grain=0
has_b_frames=1
sample_aspect_ratio=16:15
display_aspect_ratio=4:3
pix_fmt=yuv420p
level=8
color_range=tv
color_space=unknown
color_transfer=unknown
color_primaries=unknown
chroma_location=left
field_order=progressive
refs=1
id=0x1e0
r_frame_rate=25/1
avg_frame_rate=25/1
time_base=1/90000
start_pts=25854
start_time=0.287267
duration_ts=146073600
duration=1623.040000
...

> ffprobe -v error -probesize 9223372036G -analyzeduration 9223372036G -show_streams -show_data   -i "${1}"
[STREAM]
index=0
codec_name=mpeg2video
codec_long_name=MPEG-2 video
profile=Main
codec_type=video
codec_tag_string=[0][0][0][0]
codec_tag=0x0000
width=720
height=576
coded_width=0
coded_height=0
closed_captions=0
film_grain=0
has_b_frames=1
sample_aspect_ratio=16:15
display_aspect_ratio=4:3
pix_fmt=yuv420p
level=8
color_range=tv
color_space=unknown
color_transfer=unknown
color_primaries=unknown
chroma_location=left
field_order=progressive
refs=1
id=0x1e0
r_frame_rate=25/1
avg_frame_rate=25/1
time_base=1/90000
start_pts=25854
start_time=0.287267
duration_ts=146073600
duration=1623.040000
...

> ffprobe -v error -probesize 9223372036G -analyzeduration 9223372036G -show_streams -show_format -loglevel warning -print_format json -i "${1}"
{
    "streams": [
        {
            "index": 0,
            "codec_name": "mpeg2video",
            "codec_long_name": "MPEG-2 video",
            "profile": "Main",
            "codec_type": "video",
            "codec_tag_string": "[0][0][0][0]",
            "codec_tag": "0x0000",
            "width": 720,
            "height": 576,
            "coded_width": 0,
            "coded_height": 0,
            "closed_captions": 0,
            "film_grain": 0,
            "has_b_frames": 1,
            "sample_aspect_ratio": "16:15",
            "display_aspect_ratio": "4:3",
            "pix_fmt": "yuv420p",
            "level": 8,
            "color_range": "tv",
            "chroma_location": "left",
            "field_order": "progressive",
            "refs": 1,
            "id": "0x1e0",
            "r_frame_rate": "25/1",
            "avg_frame_rate": "25/1",
            "time_base": "1/90000",
            "start_pts": 25854,
            "start_time": "0.287267",
            "duration_ts": 146073600,
            "duration": "1623.040000",
...

Show Entries

> ffprobe -v error -probesize 9223372036G -analyzeduration 9223372036G -show_entries format_tags=title -of compact=p=0:nk=1 -i "${1}"
Winnetou - Eine neue Welt (Originaltitel: Winnetou & Old Shatterhand)

> ffprobe -v error -probesize 9223372036G -analyzeduration 9223372036G -show_entries format_tags=comment -of compact=p=0:nk=1 -i "${1}"
FSK 12 / 2016 / 117 Min. / imdb tt4893452 / Nik Xhelilaj, Wotan Wilke Möhring, Jürgen Vogel

> ffprobe -v error -probesize 9223372036G -analyzeduration 9223372036G -show_entries format_tags=description -of compact=p=0:nk=1 -i "${1}"
Apachenhäuptling Winnetou schließt Freundschaft mit dem deutschen Eisenbahningenieur Karl May, der später Old Shatterhand genannt wird.

> ffprobe -v error -probesize 9223372036G -analyzeduration 9223372036G -show_entries stream=codec_type -of default=noprint_wrappers=1 -i "${1}"
codec_type=video
codec_type=audio
codec_type=subtitle

> ffprobe -v error -probesize 9223372036G -analyzeduration 9223372036G -select_streams v:0 -show_entries stream=width,height,duration,bit_rate -of default=noprint_wrappers=1 -i "${1}"
width=720
height=576
duration=1623.040000
bit_rate=N/A

Spuren zählen:

> CODEC_TYPE="$(ffprobe -v error -probesize 9223372036G -analyzeduration 9223372036G -show_entries stream=codec_type -of default=noprint_wrappers=1 -i Film.mkv)"

> echo "${CODEC_TYPE}" | grep -F 'codec_type=video'    | nl | awk '{sub("="," ");print $1,$3}' | tail -n1
1 video

> echo "${CODEC_TYPE}" | grep -F 'codec_type=audio'    | nl | awk '{sub("="," ");print $1,$3}' | tail -n1
4 audio

> echo "${CODEC_TYPE}" | grep -F 'codec_type=subtitle' | nl | awk '{sub("="," ");print $1,$3}' | tail -n1
3 subtitle
/home/http/wiki/data/attic/ffprobe.1715551506.txt · Zuletzt geändert: von manfred