[Libav-user] about video duration

Safi ud Din Khan safiuddinkhan at gmail.com
Tue Dec 10 13:59:40 CET 2013


I can understand its all extremely confusing .... i have also been to 
this stuff it took me  5 moths just to understand how everything worked 
.....

my advice to you you is that you should atlest read about how mpeg 2 
compression works .... mpeg4 , h264 and other compression are quiet 
complex but at their core they work pretty much like mpeg 2 compression

atlest concern mpeg2 part in this book its bit out dated but you would 
understand that how everything works

https://dl.dropboxusercontent.com/u/15671916/video%20compression/DigitalVideoAndHDTVAlgorithmsAndInterfaces.pdf

you dont need to have to go too deep to understand video 
decoding/encoding ... ffmpeg library will do much for you ... just get 
some of how mpeg 2 codec works

On 12/10/2013 12:14 PM, YIRAN LI wrote:
> Hi friends,
>
>
> I'm now checking a duration issue of a video file.
> Here is some trace print out when file is opened, so we can know the 
> dts of last AVPacket is 167542, and the last frame  time stamp = 
> 167376, and coded_picture_num = 4013
>
>
> Line 100: 00:00:33.384 MAIN rhbc73 process packet, Packet.dts = 0, 
> Packet.pts = -9223372036854775808 Line 101: 00:00:33.384 MAIN rhbc73 
> process packet, Packet.dts = 42, Packet.pts = -9223372036854775808 
> Line 102: 00:00:33.400 MAIN rhbc73 process packet, Packet.dts = 83, 
> Packet.pts = -9223372036854775808 Line 103: 00:00:33.400 MAIN rhbc73 
> process packet, Packet.dts = 125, Packet.pts = -9223372036854775808 
> Line 104: 00:00:33.400 MAIN rhbc73 process packet, Packet.dts = 167, 
> Packet.pts = -9223372036854775808 Line 105: 00:00:33.400 MAIN rhbc73 
> -- get a full frame, pFrame->pkt_dts = 0, pFrame->pkt_pts = 
> -9223372036854775808, BestEffortTimeStamp = 0, 
> pFrame->coded_picture_number = 0 Line 107: 00:00:33.400 MAIN rhbc73 
> process packet, Packet.dts = 209, Packet.pts = -9223372036854775808 
> Line 108: 00:00:33.400 MAIN rhbc73 -- get a full frame, 
> pFrame->pkt_dts = 42, pFrame->pkt_pts = -9223372036854775808, 
> BestEffortTimeStamp = 42, pFrame->coded_picture_number = 1 Line 110: 
> 00:00:33.400 MAIN rhbc73 process packet, Packet.dts = 250, Packet.pts 
> = -9223372036854775808 Line 111: 00:00:33.416 MAIN rhbc73 -- get a 
> full frame, pFrame->pkt_dts = 83, pFrame->pkt_pts = 
> -9223372036854775808, BestEffortTimeStamp = 83, 
> pFrame->coded_picture_number = 2 Line 113: 00:00:33.416 MAIN rhbc73 
> process packet, Packet.dts = 292, Packet.pts = -9223372036854775808 
> Line 114: 00:00:33.416 MAIN rhbc73 -- get a full frame, 
> pFrame->pkt_dts = 125, pFrame->pkt_pts = -9223372036854775808, 
> BestEffortTimeStamp = 125, pFrame->coded_picture_number = 3 Line 116: 
> 00:00:33.416 MAIN rhbc73 process packet, Packet.dts = 334, Packet.pts 
> = -9223372036854775808 Line 117: 00:00:33.416 MAIN rhbc73 -- get a 
> full frame, pFrame->pkt_dts = 167, pFrame->pkt_pts = 
> -9223372036854775808, BestEffortTimeStamp = 167, 
> pFrame->coded_picture_number = 4 Line 119: 00:00:33.416 MAIN rhbc73 
> process packet, Packet.dts = 375, Packet.pts = -9223372036854775808 
> Line 120: 00:00:33.416 MAIN rhbc73 -- get a full frame, 
> pFrame->pkt_dts = 209, pFrame->pkt_pts = -9223372036854775808, 
> BestEffortTimeStamp = 209, pFrame->coded_picture_number = 5 Line 122: 
> 00:00:33.416 MAIN rhbc73 process packet, Packet.dts = 417, Packet.pts 
> = -9223372036854775808 Line 123: 00:00:33.416 MAIN rhbc73 -- get a 
> full frame, pFrame->pkt_dts = 250, pFrame->pkt_pts = 
> -9223372036854775808, BestEffortTimeStamp = 250, 
> pFrame->coded_picture_number = 6 Line 125: 00:00:33.416 MAIN rhbc73 
> process packet, Packet.dts = 459, Packet.pts = -9223372036854775808 
> Line 126: 00:00:33.416 MAIN rhbc73 -- get a full frame, 
> pFrame->pkt_dts = 292, pFrame->pkt_pts = -9223372036854775808, 
> BestEffortTimeStamp = 292, pFrame->coded_picture_number = 7 Line 128: 
> 00:00:33.416 MAIN rhbc73 process packet, Packet.dts = 501, Packet.pts 
> = -9223372036854775808 Line 129: 00:00:33.416 MAIN rhbc73 -- get a 
> full frame, pFrame->pkt_dts = 334, pFrame->pkt_pts = 
> -9223372036854775808, BestEffortTimeStamp = 334, 
> pFrame->coded_picture_number = 8 Line 131: 00:00:33.416 MAIN rhbc73 
> process packet, Packet.dts = 542, Packet.pts = -9223372036854775808 
> Line 132: 00:00:33.416 MAIN rhbc73 -- get a full frame, 
> pFrame->pkt_dts = 375, pFrame->pkt_pts = -9223372036854775808, 
> BestEffortTimeStamp = 375, pFrame->coded_picture_number = 9 Line 
> 12134: 00:00:51.168 MAIN rhbc73 process packet, Packet.dts = 167417, 
> Packet.pts = -9223372036854775808 Line 12135: 00:00:51.168 MAIN rhbc73 
> -- get a full frame, pFrame->pkt_dts = 167250, pFrame->pkt_pts = 
> -9223372036854775808, BestEffortTimeStamp = 167250, 
> pFrame->coded_picture_number = 4010 Line 12137: 00:00:51.168 MAIN 
> rhbc73 process packet, Packet.dts = 167459, Packet.pts = 
> -9223372036854775808 Line 12138: 00:00:51.168 MAIN rhbc73 -- get a 
> full frame, pFrame->pkt_dts = 167292, pFrame->pkt_pts = 
> -9223372036854775808, BestEffortTimeStamp = 167292, 
> pFrame->coded_picture_number = 4011 Line 12140: 00:00:51.168 MAIN 
> rhbc73 process packet, Packet.dts = 167501, Packet.pts = 
> -9223372036854775808 Line 12141: 00:00:51.168 MAIN rhbc73 -- get a 
> full frame, pFrame->pkt_dts = 167334, pFrame->pkt_pts = 
> -9223372036854775808, BestEffortTimeStamp = 167334, 
> pFrame->coded_picture_number = 4012 Line 12143: 00:00:51.184 MAIN 
> rhbc73 process packet, Packet.dts = 167542, Packet.pts = 
> -9223372036854775808 Line 12144: 00:00:51.184 MAIN rhbc73 -- get a 
> full frame, pFrame->pkt_dts = 167376, pFrame->pkt_pts = 
> -9223372036854775808, BestEffortTimeStamp = 167376, 
> pFrame->coded_picture_number = 4013
>
> But when I check the file using ffprobe -show_frames -select_streams v 
> input I could see
>
> [FRAME]
> media_type=video
> key_frame=0
> pkt_pts=N/A
> pkt_pts_time=N/A
> pkt_dts=167501
> pkt_dts_time=167.501000
> pkt_duration=N/A
> pkt_duration_time=N/A
> pkt_pos=103794518
> pkt_size=74
> width=1920
> height=1080
> pix_fmt=yuv420p
> sample_aspect_ratio=1:1
> pict_type=P
> coded_picture_number=4016
> display_picture_number=0
> interlaced_frame=0
> top_field_first=0
> repeat_pict=0
> [/FRAME]
> [FRAME]
> media_type=video
> key_frame=0
> pkt_pts=N/A
> pkt_pts_time=N/A
> pkt_dts=167542
> pkt_dts_time=167.542000
> pkt_duration=N/A
> pkt_duration_time=N/A
> pkt_pos=103794920
> pkt_size=74
> width=1920
> height=1080
> pix_fmt=yuv420p
> sample_aspect_ratio=1:1
> pict_type=P
> coded_picture_number=4017
> display_picture_number=0
> interlaced_frame=0
> top_field_first=0
> repeat_pict=0
> [/FRAME]
>
> the ffprobe and ffmpeg libs were built from same latest source, so I'd 
> like to know why ffprobe could dump a last frame of timestamp 167542 
> but av_read_frame + avcodec_decode_video2
> couldn't
>
>
> Thanks
>
>
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20131210/206b1cb9/attachment.html>


More information about the Libav-user mailing list