Am Sa., 26. Okt. 2019 um 20:57 Uhr schrieb Ingmar Rieger <[email protected]>:
>
> On 26.10.19 14:37, Carl Eugen Hoyos wrote:
> > Am Sa., 26. Okt. 2019 um 14:14 Uhr schrieb Ingmar Rieger <[email protected]>:
> >
> >> On 26.10.19 10:59, Carl Eugen Hoyos wrote:

> >> So basically I have an input like frame_rate (in integer for simplicity,
> >> don't care about the crazy 23.98 and other strange rates), a frame
> >> number from 0 to NUM_FRAMES-1 and ideally a start time input -> How to
> >> set the correct time base/rates and calculate the frame dts/pts?
> >
> > As said, you cannot set the time base (you can but you don't have to) but
> > you have to read the time base used by the muxer, then calculate timestamps
> > using this time base, should be possible with av_rescale_q().
>
> Ok, so what do I set and what will be set automatically in general?
> As I said I found no documentation describing how to setup a stream
> manually, that is why I asked in the first place. Just used the remux
> example (which uses avcodec_parameters_copy) as the base and manually
> read information from an existing Cineform encoded by Blackmagic to set
> the parameters manually.

There is also a transcoding example in doc/examples and there is a lot
of documentation in libavformat/avformat.h.

> With
>  > out_avstream->avg_frame_rate = (AVRational){24, 1};
>  > out_avstream->r_frame_rate   = out_avstream->avg_frame_rate;
> I now have to correct frame rate shown when av_dump_format is called but
> after writing some frames the frame rate seems to be reset.
>
> My current code that tries to set correct pts/dts values:
>  > AVRational timebase_clip  = out_avstream->time_base;

This looks reasonable.

>  > AVRational timebase_count = (AVRational){1, 24}; // also tried {24, 1}

Don't know.

>  > pkg.pts  = av_rescale_q(frame, timebase_count, timebase_clip);

Probably av_packet_rescale_ts()

>  > pkg.dts  = pkg.dts;

This looks wrong.

Carl Eugen
_______________________________________________
Libav-user mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/libav-user

To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".

Reply via email to