Skip to content

inspecting

jeanlf edited this page Jan 13, 2020 · 4 revisions

HOME » HOWTOs » File Inspection

Overview

We discuss here how to use the inspect filter to get information on sources in GPAC.

Media Streams inspection

gpac -i source.mp4 inspect

The above command will open the given source.mp4 file and print properties of each PID found in the source to stderr. Once all PIDs are found (that is, once a packet is delivered on each PID), inspection will stop.

gpac -i source.ts inspect:log=stdout:allp

The above command will open the given source.ts file and print properties of each PID found in the source to stdout. It will analyse the entire file, so that if a PID configuration change happens in the source, it will be reported.

Discussion
As usual with gpac, any source can be used, and any number of sources can also be used with the inspect filter.

gpac -i source1.h264 -i source2.aac inspect

And any filter chain can be inspected. For example, the following inspects the decoded output of a source:

gpac -i source1.h264 reframer:raw @ inspect

Packet inspection

gpac -i source.mp4 inspect:deep

The above command will open the given source.mp4 file and print properties of each PID found in the source and properties of each packet of each PID. There is no guarantee of the order of packets, depending on source type, scheduling modes, etc.

To force separate reporting per pid, use

gpac -i source.mp4 inspect:deep:interleave=false

Filtering the inspection

There are many cases where all the information of each packet is not really useful to understand a file. You can filter the packet properties you want to dump using the fmt option.

gpac -i source.mp4 inspect:interleave=false:fmt=%num%-%dts%-%cts%-%sap%-%size%%lf%:log=dump.txt

The above command will open the given source.mp4 file and print properties of each PID found in the source and for each packet, will report its number, dts, cts, RAP/SAP type and size, one packet per line:

1-0-0-1-200
2-1-1-0-10
...

The full list of options for the packet information log is given in the inspect filter help.

gpac -i source.mp4 inspect:interleave=false:fmt="PCK%num% DTS=%dts% CTS=%cts% SAP=%sap% size=%size%%lf%":log=dump.txt

This is the same as above with some nicer formatting of the output:

PCK1 DTS=0 CTS=0 SAP=1 size=200
PCK2 DTS=1 CTS=1 SAP=0 size=10
...

Analysing a source

gpac -i source.mp4 inspect:interleave=false:analyze
gpac -i source.mp4 inspect:interleave=false:deep:analyze

The above command will open the given source.mp4 file and create an XML dump of all PID properties (and all packets properties if deep is set). It will analyse the payload of the decoder configuration (parameter sets) and the payload of each packet of supported media types:

  • AVC, HEVC
  • AV1
  • MPEG1/2/4 video
  • MPEG1/2 audio

This is still a work in progress, more media types need to be added and deeper analysis of the packets should be done. It however helps you check consistency of systems layer information (timing, SAP, dependency information) with frame properties.

Clone this wiki locally
You can’t perform that action at this time.