frames and frame rate of h.264 stream
Dudi.r
dudi017 at gmail.com
Mon Apr 14 01:42:33 PDT 2014
Hi,
Im trying to implement seek on pcap file that contain h.264 stream and I
have two basic questions about h.264.
for doing so, I have function that counts the number of frame that I need to
skip and continue display the video from there.
int i=0;
int frames_to_skip= (int) (dest_time - curr_time)* FRAME_RATE;
while (i< frames_to_skip)
{
pcap_next_ex(pcap, &header, &data); //data- is pointer to
current packet.
if(start_of_frame (data))
i++;
}
pcap_next_ex () returns the next pcap packet
start_of_frame () function, checks if the current packet is start of a
frame.
for now, I dont know why, but if I skip 15 minutes, I get to 17.5 minute and
the delta keeps growing for bigger skips.
there are two thing I am not sure about and might be the resons:
1. start of frame- there are FU headers that indicates (with start and stop
bits) if this packet is the start or the end of FU-A picture.
is it o.k to assume that it is the start\end of frame? (I am counting
only if the start bit is set to 1)
there are also NAL units in the stream: Mark NAL unit- Coded slice of
a non-IDR picture.
this is also indicates something about the start\ end of frame?
I think I am counting frames
2. the frame rate- from my understanding, the frame rate is calculated as
follows:
*if the "Fixed_frame_rate_flag" is 0:* -> Frame_rate= time_scale /
Fixed_frame_rate_flag
*if the "Fixed_frame_rate_flag" is 1:* -> Frame_rate= time_scale /
(Fixed_frame_rate_flag * DeltaTfiDivisior)
“DeltaTfiDivisior” is defined as the table E-6 in the ISO/IEC
14496-10
“DeltaTfiDivisior” is defined as the table E-6 in the ISO/IEC
14496-10
http://standards.iso.org/ittf/licence.html
<http://standards.iso.org/ittf/licence.html>
but there are two parameters (for determine the
DeltaTfiDivisior)- field_pic_flag and pic_struct that not include in the
h.264 stream...
is it correct? do someone know how to calculate the frame rate from the
h.264 fields?
I will be very happy for some help on that issue.
Thanks,
Dudi.
--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/frames-and-frame-rate-of-h-264-stream-tp4666434.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.
More information about the gstreamer-devel
mailing list