Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

detect video frame types in MPEG TS stream

I'm trying to extract information about the frame types in TS packets. Using FFMEPG I'm sending MPEG TS encapsulated video (compressed with x264), and on the other side I'm recording the received packets with Wireshark. My packets are 188 bytes long, which corresponds to one MPEG TS packet. Now I need to find out which TS packets carry I, P, or B frame data.

I tried to detect Picture Header in my data (00 00 01 00), based on this post: http://forum.digital-digest.com/f4/help-extract-i-frames-mpeg2-ts-89736.html but I couldn't find it. All I can register is the start of PES packet (00 00 00 01 E0). I'm totaly confused about the formats. Which part of PES says which frame type one TS packet transmits?

Thank you.

like image 620
stani Avatar asked Aug 24 '12 15:08

stani


1 Answers

Just capture all your content in ts form and run ffprobe over it.

ffprobe -show_frames and look for pict_type in the video frames. Write a small script to parse the output and give you the output. If you are too lazy to do that

ffprobe -show_frames | grep pict_type | grep -n I
should give you frame numbers directly.

will work for any format as long as it is a valid video file.

like image 127
av501 Avatar answered Sep 30 '22 16:09

av501