Activity › Forums › Compression Techniques › HANDY TIP: Using FFprobe for stream analysis
-
HANDY TIP: Using FFprobe for stream analysis
Milivoj Ivkovic replied 8 years, 6 months ago 11 Members · 21 Replies
-
Oussama Stiti
March 22, 2012 at 2:12 amHello,
I want to detect the distorded frames ( corrupted or loss) and, i want to edit a log file, wich exctract such informations, like slice #, frame ID, related frames, type of frame.
Is it possible with ffprobe, to display such informations ( damaged frame) ?I’m running on ubuntu, and i’m broadcasting a video in the loopback IP, using a VLC player client, and a VLC player server.
-
Oche Ejembi
August 15, 2013 at 12:08 pmHey!
I am sorry to be the guy to comment on a 3 year old thread, but I have to ask.
My version of ffprobe (ffprobe version 0.11.1) -show-frames doesn’t show the size of frames (it does for packets though). Any ideas on what I can do? What’s the relationship between packets and frames?
This is a sample from my output
##################FRAME#####################
[FRAME]
media_type=video
key_frame=0
pkt_pts=784784
pkt_pts_time=0:00:26.159467
pkt_dts=784784
pkt_dts_time=0:00:26.159467
pkt_pos=20156243
width=1920
height=1080
pix_fmt=yuv420p
sample_aspect_ratio=N/A
pict_type=P
coded_picture_number=784
display_picture_number=0
interlaced_frame=0
top_field_first=0
repeat_pict=0
reference=0
[/FRAME]##################PACKET#####################
[PACKET]
codec_type=video
stream_index=0
pts=789789
pts_time=0:00:26.326300
dts=789789
dts_time=0:00:26.326300
duration=1001
duration_time=0:00:00.033367
size=24.804688 Kibyte
pos=20354166
flags=_
[/PACKET -
Michael Rampe
August 16, 2013 at 8:20 amwow. I have not looked at my code on this in a long time….
I am using a very recent compile (V2.x) and I am not getting size anymore either.
I am, however getting pkt_size for H.264 streams. It looks like it is in Bytes to me… maybe try to upgrade?
[FRAME]
media_type=video
key_frame=1
pkt_pts=1539
pkt_pts_time=61.560000
pkt_dts=1539
pkt_dts_time=61.560000
pkt_duration=1
pkt_duration_time=0.040000
pkt_pos=10862541
pkt_size=56311
width=854
height=480
pix_fmt=yuv420p
sample_aspect_ratio=1:1
pict_type=I
coded_picture_number=1539
display_picture_number=0
interlaced_frame=0
top_field_first=0
repeat_pict=0
[/FRAME]FYI, my line was: ffprobe -show_frames -i tests_cut1_x264.mov
and my version is:
ffprobe version N-54992-g63c0113 Copyright (c) 2007-2013 the FFmpeg developers
built on Jul 28 2013 19:42:17 with Apple LLVM version 4.2 (clang-425.0.27) (based on LLVM 3.2svn)
configuration: –enable-gpl –enable-postproc –enable-swscale –enable-libmp3lame –enable-libfaac –enable-libx264 –enable-nonfree –enable-shared –arch=x86_64 –extra-cflags=/usr/local/lib –enable-avfilter –enable-libfreetype –enable-frei0r –cc=clang
libavutil 52. 40.100 / 52. 40.100
libavcodec 55. 19.100 / 55. 19.100
libavformat 55. 12.102 / 55. 12.102
libavdevice 55. 3.100 / 55. 3.100
libavfilter 3. 81.103 / 3. 81.103
libswscale 2. 4.100 / 2. 4.100
libswresample 0. 17.103 / 0. 17.103
libpostproc 52. 3.100 / 52. 3.100Michael
p.s. Glad this is still useful after all this time. I was very much a newbie when I did this;-) If you get a new version of this graphing stuff going, please post!
-
Oche Ejembi
August 16, 2013 at 3:19 pmJust in case this helps anyone. I upgraded to the latest version of ffmpeg and I get the pkt_size information with the show-frames tag.
-
Oche Ejembi
August 16, 2013 at 3:23 pmThanks a lot for this. I wish I’d seen this a few hours earlier. would have save me some time. I upgraded and it worked.
WIll definitely post if I can script the graphing although I think you’ve done a great job already.
-
Oche Ejembi
August 19, 2013 at 11:32 pmTurns out the good people developing ffmpeg recently added a graphing tool written in Perl and using Gnuplot and ffprobe.
In the latest repo, you can find it in tools/plotframes. Its simple enough to use and gives quite impressive graphs on X11. Currently looking for how to maintain that same quality
.ffmpeg/tools/plotframes -i video.mp4 [-t svg -o video.svg]
The -t and -o flags are optional and sets the terminal and the output file respectively. A lot of options are available to set the terminal from the gnuplot manual or typing set terminal within the gnuplot environment
-
Eric Work
December 9, 2013 at 5:02 amThe plotframes tool, which is part of the FFMPEG repository, was written in Perl and is very slow for large files. I wrote my own version of this tool using Python 3 which is much faster. Instead of reading the entire JSON output from FFProbe before processing begins my script pipes XML data from FFProbe and uses a stream XML processor to parse the frame data. Matplotlib is then used to plot the data which requires no temporary files. The result is about 5-10% overhead over FFProbe. The major bottleneck when processing an HD video that’s 3+ hours long is FFProbe. I got tired of waiting after 2 hours for plotframes to even start generating the temp files for a 3 hour movie, while my script was done in 40 min. You can find my script in my github repo below.
https://github.com/zeroepoch/plotbitrate
-
Quang Nguyễn văn
January 6, 2014 at 9:01 amI use latest version ffprobe. when I using command line of you (I was replayed size=pkt_size) but I get raw.dat file contains:
…
coded_picture_number=70
pkt_size=10498
coded_picture_number=71
pkt_size=498
pkt_size=497
pkt_size=464
pkt_size=453
pkt_size=452
pkt_size=464
pkt_size=462
pkt_size=454
pkt_size=449
pkt_size=459
pkt_size=469
pkt_size=468
pkt_size=475
pkt_size=462
pkt_size=503
pkt_size=526
pkt_size=490
pkt_size=494
pkt_size=501
pkt_size=457
pkt_size=435
pkt_size=10908
coded_picture_number=72
pkt_size=11168
…
and column.dat file contains:
…
pkt_215 0
pkt_37 1
pkt_37 2
pkt_27182 3
pkt_6601 4
pkt_3540 5
pkt_5845 6
pkt_6190 7
pkt_5860 8
pkt_6284 9
pkt_6295 10
pkt_6816 11
pkt_7073 12
pkt_9 pkt_9
pkt_34 pkt_464
pkt_407 pkt_441
pkt_430 pkt_428
pkt_380 pkt_346
pkt_334 pkt_320
pkt_316 pkt_339
pkt_351 pkt_348
pkt_364 pkt_347
pkt_359 pkt_376
pkt_474 pkt_438
pkt_7133 13
pkt_7535 14
….and, I use gnuplot to raw but that is incoret.
I get error:
warning: Skipping data file with no valid points
can you help me? -
Matt Fisher
October 21, 2014 at 7:11 pmI am receiving the same error when executing the gnuplot commands in terminal
“warning: Skipping data file with no valid points” were you able to find a solution?Thanks,
matt
-
Oren Shalmy
January 28, 2015 at 12:54 pmHi Michael
I came across this thread and would like to try to replicate this on my office’s Windows machine.
Could you please share the formation of your “gnuplot plot.txt” file.
I’ve tried reversing your SED commands with Windows findstr, so far unsuccessfully.Thank you!
Oren
Reply to this Discussion! Login or Sign Up