[Libav-user] hardware encoding on Raspberry Pi using Openmax has issue of time stamp
Jinbo Li
jinbo.li at savoirfairelinux.com
Mon Nov 19 23:25:44 EET 2018
Hello Mark,
It works. Thanks a lot.
Regards,
Jinbo Li
----- Message original -----
De: "Mark Thompson" <sw at jkqxz.net>
À: "libav-user" <libav-user at ffmpeg.org>
Envoyé: Lundi 19 Novembre 2018 14:59:09
Objet: Re: [Libav-user] hardware encoding on Raspberry Pi using Openmax has issue of time stamp
On 19/11/18 18:14, Jinbo Li wrote:
> Hello,
>
> Hello, I have an issue on implementing hardware encoding on raspberry pi by using openmax. The problem is that I always get wrong time stamp in my AVpacket even right after it gets initialized, the time stamp was always assigned to be 634 (seems to be the numerator of time base) and it does not change overtime. I have run this code on my another Ubuntu laptop, it doesn't have this issue for the printf.
>
> code:
>
> AVPacket pkt;
> printf("0-time stamp = %ld, enc = %d/%d st = %d/%d\n", pkt.pts,
> encoder_ctx->time_base.num,encoder_ctx->time_base.den,
> fmt_encoder_ctx->streams[video_stream]->time_base.num,
> fmt_encoder_ctx->streams[video_stream]->time_base.den);
> printf("avframe time stamp = %ld\n", sw_frame->pts);
> av_init_packet(&pkt);
> printf("1-time stamp = %ld, enc = %d/%d st = %d/%d\n", pkt.pts,
> encoder_ctx->time_base.num,encoder_ctx->time_base.den,
> fmt_encoder_ctx->streams[video_stream]->time_base.num,
> fmt_encoder_ctx->streams[video_stream]->time_base.den);
>
> result:
>
> 0-time stamp = 634, enc = 1907363872/0 st = 634/19001
> 1-time stamp = 634, enc = 0/-2147483648 st = 634/19001
> ...(the printed time stamp is always 634 below)
The timestamp is not a long, so you're invoking undefined behaviour and the printed numbers are meaningless. You want PRId64 for printing timestamps.
- Mark
_______________________________________________
Libav-user mailing list
Libav-user at ffmpeg.org
http://ffmpeg.org/mailman/listinfo/libav-user
More information about the Libav-user
mailing list