[Libav-user] MPEG4 decoding - in reverse order

Rouhi Amirhossein s3288736 at student.rmit.edu.au
Tue Sep 13 03:28:05 CEST 2011

As far as i know the key frames can be categorized to two type of
referencing frames: IDR frames and I-Frames. IDR frames are more important
because they actually break the video stream, in this mean that all frames
after IDR frame are not related to any frames before IDR. So IDR are a very
special type of I-Frame. After IDR, we can see referencing and non
referencing frames which are: I,P and B frames. I-Frames can be considered
as key frames because the P and B should reference to I-frames (before or
even after them) directly(for P frames) or indirectly(for B frames.
For detecting IDR frames and I-Frames in NAL units you should search a
specific bitstream.
The bitstream format is 00 00 01 X Y (in Hex)

X =  IDR Picture NAL Units (25, 45, 65)
X = Non IDR Picture NAL Units (01, 21, 41, 61) ; 01 = b-frames, 41 =
since frames can be splitted over multiple NAL Units only consider the NAL
Units with Y != 00 (in golomb code it would be 0×80)


On 12 September 2011 16:12, amol mahamuni <ajm2707 at yahoo.com> wrote:

> Hello Experts!
> I have MPEG4 stream from rtsp server. I could decode it and play it using
> ffmepg library.
> I stored the stream as binary files for later playing using ffmpeg
> library.
> I can play the stream in forward direction - just I want to feed the ffmpeg
> decoder with stored frames.
> A) *Now, my requirement is to play the stream in reverse direction*. Can
> you ppl suggest me a way to accomplish this?
> I tried to feed the stored packets/data in reverse way but of course it's
> giving  bad stream (distorted and ill-motion video display).
> Is there any trick through which decoder can understand about reverse
> playing? Is reverse playing possible with ffmpeg decode?
> B) Also, what is key frame in MPEG4 video stream? How can I understand key
> frame?
> If I could understand key frame, does decoder give a good decoded frame
> when I fed it with key frame?
> My understanding is that when I feed MPEG4 key frame, ffmepg will output
> good decoded frame
> - meaning key frame does not depend on other frames to produce good decoded
> frame output. Is it correct?
> Thanks,
> -Amol.
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user

Amir H. Rouhi
PhD Student/ CSIT RMIT University
Room: 14-09-04
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20110913/b523b088/attachment.html>

More information about the Libav-user mailing list