pythonimage-processingffmpegffprobetransport-stream

File type not recognized when using ffprobe with Python


This is my python script:

#!/usr/bin/python3
import os, sys, subprocess, shlex, re
from subprocess import call

def probe_file(filename):
    cmnd = ['ffprobe', '-show_packets', '-show_frames', '-print_format', filename]
    p = subprocess.Popen(cmnd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    print filename
    out, err =  p.communicate()
    print "Output:"
    print out
    if err:
        print "Error:"
        print err

probe_file(sys.argv[1])

Being run with this command:

python parse_frames_and_packets.py mux_test.ts

And I'm getting the following error output:

Unknown output format with name 'mux_test.ts'

Can you not use .ts file types when using ffprobe with Python? Because I've run ffprobe alone using this exact file and it worked correctly.

Does anyone have any tips?

Edit: it seems to not recognize all types of video, not just transport stream (I just tried it with .avi and got the same response).


Solution

  • -print_format (or the -of alias) requires a format. Available formats are: default, compact, csv, flat, ini, json, xml.

    Example:

    ffprobe -loglevel error -show_streams -print_format csv=p=0 input.mkv
    

    See the ffprobe documentation for more info.