


Then “parseOutput” parses the text output, extracts the values for “pkt_size” and “pict_type”, and converts them into Pandas DataFrame, which is ready to be drawn with Plotly. This is done in cell 3 of the notebook, which first calls the following ffprobe command to get per frame metadata: ffprobe -v error -select_streams v:0 -show_frames input.mp4Ī sample output for one frame is like this: media_type=video stream_index=0 key_frame=0 pkt_pts=495000 pkt_pts_time=5.500000 pkt_dts=495000 pkt_dts_time=5.500000 best_effort_timestamp=495000 best_effort_timestamp_time=5.500000 pkt_duration=3000 pkt_duration_time=0.033333 pkt_pos=379090 pkt_size=629 width=560 height=320 pix_fmt=yuv420p sample_aspect_ratio=N/A pict_type=P coded_picture_number=165 display_picture_number=0 interlaced_frame=0 top_field_first=0 repeat_pict=0 color_range=tv color_space=bt709 color_primaries=bt709 color_transfer=bt709 chroma_location=left The first piece of information I want to extract is the I/P/B type of each frame and how many bytes they take in the stream relative to others.

You may need to modify “util/load-ffmpeg.ipynb” for where to get the static FFmpeg build compatible with your host if you are not running Ubuntu. Starting from my Github repository ( ), click the “launch binder” icon to create a Jupyter running environment for this repository, and select notebook “video-stream-analysis-demo.ipynb” to launch.Īlternatively you can download the repository and run a local Jupyter Notebook server. This time I’m going to walk you through another notebook for video stream analysis, to showcase what FFmpeg commands can be useful to generate metrics of interest, how to convert the console output to data types ready for visualization, and how to create interactive plots. In my previous post ( Encode videos from your browser with Jupyter Notebook ), I explained the basics of deploying FFmpeg in a Jupyter Notebook for video compression. frame types and sizes, PSNR, SSIM, VMAF, and motion vectors.

Create interactive plots of frame level metrics for encoded stream analysis, e.g.
