[FFmpeg-devel] Adding Sequence number to frames

Stefano Sabatini stefasab at gmail.com
Wed Feb 27 15:19:34 CET 2013

On date Monday 2013-02-25 22:45:49 +0800, XUE MINGQIANG encoded:
> Hi All,
> I am very new to both streaming and ffmpeg.
> Basically, I want to achieve the following task:
> I have a LAN and a RTSP video source machine. I want to do some CV
> task e.g. face detection, on another machine, and display the result
> in the form of continuous original video stream (with detected faces
> in rectangles) on a client machine in the same LAN. I want to have the
> following design:

An alternative design if you can do some coding, you might integrate
OpenCV face detection into libavfilter (see ocv filter), and send only
the marked frames to output.

> Ideally, each frame of the video stream is labelled with a unique
> sequence number. On the CV-task machine, I select the frames that need
> for face detection, record down its sequence number and coordinates of
> detected faces. Then I forward the (sequence number, coordinates)
> pairs to the client machine. The client machine runs an RTSP client
> and receive stream from the source, but instead of playing the stream
> directly, it temporally stores the received frame in a buffer until it
> receives the (sequence number, coordinates) from the CV-task machine.
> The sequence number is used to find the frame on which the rectangles
> for faces should be put onto. Once the rectangles are added to the
> right frames, the video is read from the buffer and played.
> My questions are as follows:

> 1. Does each frame of a video stream, e.g. the H264 stream contain an
> unique identifier? If so, how to get this unique identifier?

The PTS (presentation timestamp) is or should be unique (but not
necessarily a sequential integer).
FFmpeg = Formidable and Freak Mournful Plastic Evil God

More information about the ffmpeg-devel mailing list