Inspecting H.264 Headers

From RidgeRun Developer Wiki
Revision as of 15:16, 19 March 2014 by Tfischer (talk | contribs) (Created page with '= Introduction = The [http://mpeg4ip.sourceforge.net MPEG4IP] project has a nice tool you can use to extract the H264 headers. = Removing file container = If the H.264 video i...')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Introduction

The MPEG4IP project has a nice tool you can use to extract the H264 headers.

Removing file container

If the H.264 video is in a Transport Stream container, you can use GStreamer to remove the TS wrapper:

INPUT_TS_FILE=video.m2t
OUTPUT_264_FILE=video.264

gst-launch filesrc location=$INPUT_TS_FILE  ! mpegtsdemux ! filesink location=$OUTPUT_264_FILE

If the H.264 video is in an MP4 container, you can use GStreamer to remove the MP4 wrapper:

INPUT_MP4_FILE=vido.mp4
OUTPUT_264_FILE=video.264

gst-launch filesrc location=$INPUT_MP4_FILE ! qtdemux ! h264parse output-format=1 ! filesink location=$OUTPUT_264_FILE

The GStreamer pipeline uses the h264parse element to convert the H264 content from packetized to bytestream in the MP4 file.

Examining H.264 headers

Now you can use the h264_parse tool to extract the H.264 headers. This tool belongs to the MPEG4IP package

h264_parse $OUTPUT_264_FILE

The h264_parse tool expects the H.264 video file to be in bytestream format in order to extract the headers.

Example H.264 header