Hi,
I'm working on a lossless GOP-based cutter to handle TV-recordings. I
try to handle mpeg2video and h264 as video-streams.
I collect all video-frames/packets within one GOP, starting with first
withAVPacket->flag & AV_PKT_FLAG_KEY until the AVPacket before the next
AVPacket->flag & AV_PKT_FLAG_KEY.
Now I like to identify all audio-frames/packets associated with the GOP.
First I calculate the minimum- and maximum-PTS of the GOP and take all
audio-packets between. This works fine with h264 - every frame has a
PTS. But using mpeg2video, frames will have PTSwithout value
(AV_NOPTS_VALUE) and the min/max calculation will be not match to the
full GOP-duration.
By working on that, I found out, that the delay of PTS to DTS on
GOP-Level is constant within a video-stream. So it looks like that I can
fetch audio-frames easily by working with a fixed delay:
----
Assign audio frame to GOP:
assume: audio->pts == audio->dts and audio-stream->timebase ==
video-stream->timebase
note: duration will NOT ignored in real code
if (audio->pts >= video-keyframe[n]->dts + video-dts-pts-delay &&
audio->pts < video-keyframe[n+1]->dts + video-dts-pts-delay) {
// MATCH
}
----
1. QUESTION:
Is this a good or a bad idea in general?
2. QUESTION:
Is there any way to get a valid delay between DTS and PTS on GOP-Level
for mpeg2video?
Thanks for your help in advanced
Jan
_______________________________________________
libav-api mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-api