Pts problem with variable framerate mpeg4 video in mpegts stream

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Pts problem with variable framerate mpeg4 video in mpegts stream

Marijn van Galen
On 2008.01.05 01:31, [hidden email] wrote:

> Your mail to 'ffmpeg-user' with the subject
>
>     Pts problem with variable framerate mpeg4 video in mpegts stream
>
> Is being held until the list moderator can review it for approval.
>
> The reason it is being held:
>
>     Message body is too big: 48950 bytes with a limit of 40 KB
>
Well this was more than 2 weeks ago, so I am resending this mail with a
few attachments left out. Though I wonder if there is anybody reading
the list-moderator email...


Hello list,

I am trying to get a mpegts stream which contains a variable framerate
mpeg4 stream working, but have trouble playing it back.

To demonstrate the problem I am encountering (or my misunderstanding of
the API), I made a few adjustments to output_example.c from the ffmpeg
svn version of today (diff attached).

I am trying to achieve the following: I want to create a mpegts stream,
with an audiostream, with constant sample-rate and a mpeg4 videostream
with an average framerate of 25fps. For my application this videostream
needs to have ms-accuracy timestamps which correlate with the
timestamps of the audio-frame-packets. Therefore I changed time_base to
1/1000 and set r_frame_rate to 25. I also added a printf to show that
the pkt.pts values are as I would expect. (I increment the video.pts
with 45 instead of 40 to simulate an slower than average stream)

Now if I play the generated file with ffplay, the results are not as I
would expect. The video plays to fast, stutters and the bitrate has
automagically changed (suddenly a lot of compression artifacts).

I also added some printf's to ffplay (diff also attached) to check what
is going on and allthough the video-pts values are correct, most of the
pkt.pts values are AV_NOPTS_VALUE, which seems incorrect to me.


output_example.c + output_example.orig.c.diff -> ffplay.orig.output
output_example.c + output_example.c.diff ->
                              output_example.output & ffplay.output

Could someone provide me with some pointers about what is going on, am
I doing something wrong or have I hit a bug in ffmpeg?

Thanks in advance,

Marijn





_______________________________________________
ffmpeg-user mailing list
[hidden email]
http://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-user

output_example.output (12K) Download Attachment
ffplay.output (15K) Download Attachment
ffplay.c.diff (875 bytes) Download Attachment
output_example.c.diff (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Pts problem with variable framerate mpeg4 video in mpegts stream

Claudio Bertozzi
hallo Marijn,

I try to respond to your question because I'm also in trouble with correct
frame interleaving since a lot of time.
There are some thing that I don't understand in your message:

I changed time_base to 1/1000

for MPEG streams time base it's 1/90000 [tick/second]


> I increment the video.pts with 45 instead of 40

for a 25 fps MPEG video, PTSs must be incremented by 3600 not 40 (in
tick/sec)

I'm pretty sure that at least this few things are true, but I'm not a guru
and I've also experienced a lot of trouble managing PTSs in audio/video
streams (most of all not yet resolved). I hope you find useful this few
informations.

bye

Claudio

2008/1/21 Marijn van Galen <[hidden email]>:

> On 2008.01.05 01:31, [hidden email] wrote:
> > Your mail to 'ffmpeg-user' with the subject
> >
> >     Pts problem with variable framerate mpeg4 video in mpegts stream
> >
> > Is being held until the list moderator can review it for approval.
> >
> > The reason it is being held:
> >
> >     Message body is too big: 48950 bytes with a limit of 40 KB
> >
>
> Well this was more than 2 weeks ago, so I am resending this mail with a
> few attachments left out. Though I wonder if there is anybody reading
> the list-moderator email...
>
>
> Hello list,
>
> I am trying to get a mpegts stream which contains a variable framerate
> mpeg4 stream working, but have trouble playing it back.
>
> To demonstrate the problem I am encountering (or my misunderstanding of
> the API), I made a few adjustments to output_example.c from the ffmpeg
> svn version of today (diff attached).
>
> I am trying to achieve the following: I want to create a mpegts stream,
> with an audiostream, with constant sample-rate and a mpeg4 videostream
> with an average framerate of 25fps. For my application this videostream
> needs to have ms-accuracy timestamps which correlate with the
> timestamps of the audio-frame-packets. Therefore I changed time_base to
> 1/1000 and set r_frame_rate to 25. I also added a printf to show that
> the pkt.pts values are as I would expect. (I increment the video.pts
> with 45 instead of 40 to simulate an slower than average stream)
>
> Now if I play the generated file with ffplay, the results are not as I
> would expect. The video plays to fast, stutters and the bitrate has
> automagically changed (suddenly a lot of compression artifacts).
>
> I also added some printf's to ffplay (diff also attached) to check what
> is going on and allthough the video-pts values are correct, most of the
> pkt.pts values are AV_NOPTS_VALUE, which seems incorrect to me.
>
>
> output_example.c + output_example.orig.c.diff -> ffplay.orig.output
> output_example.c + output_example.c.diff ->
>                              output_example.output & ffplay.output
>
> Could someone provide me with some pointers about what is going on, am
> I doing something wrong or have I hit a bug in ffmpeg?
>
> Thanks in advance,
>
> Marijn
>
>
>
>
>
> _______________________________________________
> ffmpeg-user mailing list
> [hidden email]
> http://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-user
>
_______________________________________________
ffmpeg-user mailing list
[hidden email]
https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-user