Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ffprobe - getting file info from pipe

Tags:

ffmpeg

ffprobe

I've got an oog file (it was mixed by sox from two audiostreams recorded by pbx Asterisk) and I'm trying to get file information with ffprobe. When I use something like

cat %filename%.ogg | ffprobe -i - 

I get invalid file info (Duration : N/A, wrong bitrate and etc.) When I try

ffprobe -i %filename%

Everything works fine and I get file info. What could be wrong? File content?

like image 815
Andrey Baryshnikov Avatar asked Dec 07 '12 12:12

Andrey Baryshnikov


2 Answers

As of version 1.0.7 of ffprobe you can even get the output in a JSON formatted output:

ffprobe -v quiet -print_format json -show_format Ramp\ -\ Apathy.mp3

Which produces the follwing output:

{
    "format": {
        "filename": "Ramp - Apathy.mp3",
        "nb_streams": 2,
        "format_name": "mp3",
        "format_long_name": "MP2/3 (MPEG audio layer 2/3)",
        "start_time": "0.000000",
        "duration": "203.638856",
        "size": "4072777",
        "bit_rate": "159999",
        "tags": {
            "title": "Apathy",
            "artist": "Ramp",
            "album": "Evolution Devolution Revolution",
            "date": "1999",
            "genre": "Metal"
        }
    }
}

I think you can get the probe using cat, do you have any requirement to cat the file contents? If not just use ffprobe without cat.

like image 89
Paulo Fidalgo Avatar answered Nov 18 '22 14:11

Paulo Fidalgo


Just a quick note to say that piping input to ffprobe seems to work just fine. Use a hyphen in place of the input file and you are off to the races. Here is an example with a random video file on my system:

cat 01.mp4 | ffprobe -show_format -pretty -loglevel quiet -

Returns:

[FORMAT]
filename=pipe:
nb_streams=2
nb_programs=0
format_name=mov,mp4,m4a,3gp,3g2,mj2
format_long_name=QuickTime / MOV
start_time=N/A
duration=0:02:56.400000
size=N/A
bit_rate=N/A
probe_score=100
TAG:major_brand=isom
TAG:minor_version=512
TAG:compatible_brands=isomiso2mp41
TAG:creation_time=1970-01-01T00:00:00.000000Z
TAG:title=yy.mp4
TAG:encoder=Lavf52.78.3
[/FORMAT]
like image 32
Keith Ma Avatar answered Nov 18 '22 14:11

Keith Ma