[Libav-user] FFMpeg Question about paket pts, dts and duration parameters

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

[Libav-user] FFMpeg Question about paket pts, dts and duration parameters

Denis Gottardello

 

 

Hi, after having implemented the remuxing.c example my program works with file to file but not with rtsp camera to file.

I think that the problem is related to the following lines of code:

 

Packet.pts= av_rescale_q_rnd(Packet.pts, pAVStreamIn->time_base, pAVStreamOut->time_base, static_cast<AVRounding>(AV_ROUND_NEAR_INF | AV_ROUND_PASS_MINMAX));

Packet.dts= av_rescale_q_rnd(Packet.dts, pAVStreamIn->time_base, pAVStreamOut->time_base, static_cast<AVRounding>(AV_ROUND_NEAR_INF | AV_ROUND_PASS_MINMAX));

Packet.duration= av_rescale_q(Packet.duration, pAVStreamIn->time_base, pAVStreamOut->time_base);

 

The code works with file to file but not using an rtsp camera as source to file. I obtain an error at av_interleaved_write_frame function. Please have a look at the following log report:

 

AudioIndex Packet.pts: 0, Packet.dts: 0, Packet.duration: 160

AudioIndex Packet.pts: 120, Packet.dts: 120, Packet.duration: 160

AudioIndex Packet.pts: 312, Packet.dts: 312, Packet.duration: 160

AudioIndex Packet.pts: 432, Packet.dts: 432, Packet.duration: 160

AudioIndex Packet.pts: 632, Packet.dts: 632, Packet.duration: 160

AudioIndex Packet.pts: 752, Packet.dts: 752, Packet.duration: 160

AudioIndex Packet.pts: 952, Packet.dts: 952, Packet.duration: 160

AudioIndex Packet.pts: 1072, Packet.dts: 1072, Packet.duration: 160

AudioIndex Packet.pts: 1272, Packet.dts: 1272, Packet.duration: 160

AudioIndex Packet.pts: 1392, Packet.dts: 1392, Packet.duration: 160

AudioIndex Packet.pts: 1592, Packet.dts: 1592, Packet.duration: 160

AudioIndex Packet.pts: 1712, Packet.dts: 1712, Packet.duration: 160

VideoIndex Packet.pts: 9223372036854775808, Packet.dts: 9223372036854775808, Packet.duration: 0

 

As you can see the pts, dts and duration parameters relative to audio stream is ok, the video parameters abolutally not. How can I do to rewrite the video parameters? Can anyone explain?

How can I calculate pts and dts using current time stamp?

Have you got a example for me?

I have tryed in this way but does not work

Packet.pts= Packet.dts= VideoPacketNumber++;

Many thanks.


--

+39.347.4070897

http://www.labcsp.com

http://www.denisgottardello.it

GMT+1

Skype: mrdebug


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

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: FFMpeg Question about paket pts, dts and duration parameters

Carl Eugen Hoyos-2
Am Di., 28. Apr. 2020 um 16:57 Uhr schrieb Denis Gottardello
<[hidden email]>:
>
>
>
>
>
> Hi, after having implemented the remuxing.c example my program works with file to file but not with rtsp camera to file.

Does it work with ffmpeg (the application)?

Does the rtsp demuxer returns any useful timestamps at all for video
if you read more packets but if you do not try to write anything?

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

To unsubscribe, visit link above, or email
[hidden email] with subject "unsubscribe".
Reply | Threaded
Open this post in threaded view
|

Re: FFMpeg Question about paket pts, dts and duration parameters

Denis Gottardello

 


With this command line

./ffmpeg -i rtsp://192.168.1.11:554/onvif1 test.mpg

it works, with this output:

 

Input #0, rtsp, from 'rtsp://192.168.1.11:554/onvif1':

Metadata:

title : H.264 Video, RtspServer_0.0.0.2

Duration: N/A, start: 0.000000, bitrate: N/A

Stream #0:0: Video: h264 (Baseline), yuv420p(progressive), 1280x720, 24.92 tbr, 90k tbn, 180k tbc

Stream #0:1: Audio: pcm_alaw, 8000 Hz, mono, s16, 64 kb/s

Stream mapping:

Stream #0:0 -> #0:0 (h264 (native) -> mpeg1video (native))

Stream #0:1 -> #0:1 (pcm_alaw (native) -> mp2 (native))

Press [q] to stop, [?] for help

[mpeg @ 0x55c6280f5c00] VBV buffer size not set, using default size of 230KB

If you want the mpeg file to be compliant to some specification

Like DVD, VCD or others, make sure you set the correct buffer size

Output #0, mpeg, to 'test.mpg':

Metadata:

title : H.264 Video, RtspServer_0.0.0.2

encoder : Lavf58.29.100

Stream #0:0: Video: mpeg1video, yuv420p, 1280x720, q=2-31, 200 kb/s, 25 fps, 90k tbn, 25 tbc

Metadata:

encoder : Lavc58.54.100 mpeg1video

Side data:

cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1

Stream #0:1: Audio: mp2, 16000 Hz, mono, s16, 160 kb/s

Metadata:

encoder : Lavc58.54.100 mp2

frame= 789 fps= 28 q=31.0 Lsize= 2382kB time=00:00:32.65 bitrate= 597.5kbits/s dup=635 drop=0 speed=1.18x

 

 

 

In data martedì 28 aprile 2020 18:14:45 CEST, Carl Eugen Hoyos ha scritto:

> Am Di., 28. Apr. 2020 um 16:57 Uhr schrieb Denis Gottardello

>

> <[hidden email]>:

> > Hi, after having implemented the remuxing.c example my program works with

> > file to file but not with rtsp camera to file.

> Does it work with ffmpeg (the application)?

>

> Does the rtsp demuxer returns any useful timestamps at all for video

> if you read more packets but if you do not try to write anything?

>

> Carl Eugen

> _______________________________________________

> Libav-user mailing list

> [hidden email]

> https://ffmpeg.org/mailman/listinfo/libav-user

>

> To unsubscribe, visit link above, or email

> [hidden email] with subject "unsubscribe".
--

+39.347.4070897

http://www.labcsp.com

http://www.denisgottardello.it

GMT+1

Skype: mrdebug


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

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