<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2018-05-12 12:03 GMT+03:00 Paul B Mahol <span dir="ltr"><<a href="mailto:onemda@gmail.com" target="_blank">onemda@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="gmail-m_-7712734348208240675HOEnZb"><div class="gmail-m_-7712734348208240675h5">On 5/12/18, Yurii Monakov <<a href="mailto:monakov.y@gmail.com" target="_blank">monakov.y@gmail.com</a>> wrote:<br>
> Hi, FFmpeg users!<br>
><br>
> I'm developing a stream recording application. So it takes arbitrary stream<br>
> and records it in chunks of approx 20 minutes, splitting input stream at<br>
> key frame boundaries.<br>
><br>
> I'm using this stream for testing purposes (recording only video stream):<br>
> <a href="http://bitmovin-a.akamaihd.net/content/playhouse-vr/m3u8s/105560.m3u8" rel="noreferrer" target="_blank">http://bitmovin-a.akamaihd.net<wbr>/content/playhouse-vr/m3u8s/<wbr>105560.m3u8</a><br>
> It initializes properly and first packets, including first key frame, are<br>
> good. I save them with output context without any problem.<br>
><br>
> But when next key frames arrive their PTS/DTS are set to AV_NOPTS_VALUE.<br>
> av_interleaved_write_frame function expectedly complains about it and<br>
> produces garbled videos. This is strange, because av_read_frame function<br>
> states that<br>
><br>
> * pkt->pts, pkt->dts and pkt->duration are always set to correct<br>
> * values in AVStream.time_base units (and guessed if the format cannot<br>
> * provide them).<br>
><br>
> I've tried to open this stream by ffmpeg with '-fdebug t' option and it<br>
> also shows key frame packets without PTS:<br>
><br>
> $ ffmpeg -fdebug ts -i<br>
> <a href="http://bitmovin-a.akamaihd.net/content/playhouse-vr/m3u8s/105560.m3u8" rel="noreferrer" target="_blank">http://bitmovin-a.akamaihd.net<wbr>/content/playhouse-vr/m3u8s/<wbr>105560.m3u8</a> -an<br>
> -f null<br>
> ...<br>
> [hls,applehttp @ 0xe004e0] ff_read_packet stream=1, pts=NOPTS, dts=NOPTS,<br>
> size=464722, duration=3003, flags=1<br>
> [hls,applehttp @ 0xe004e0] read_frame_internal stream=1, pts=NOPTS,<br>
> dts=NOPTS, size=464722, duration=3003, flags=1<br>
> [hls,applehttp @ 0xe004e0] ff_read_packet stream=1, pts=1099098,<br>
> dts=1084083, size=223452, duration=3003, flags=0<br>
> [hls,applehttp @ 0xe004e0] read_frame_internal stream=1, pts=1099098,<br>
> dts=1084083, size=223452, duration=3003, flags=0<br>
> ...<br>
> As you can see, PTS/DTS are missing only in key frame (flags=1).<br>
><br>
> Remuxing this stream to mp4 with ffmpeg gives no artifacts on the video and<br>
> no errors are shown in the output. So it fixes PTS/DTS somehow to maintain<br>
> their sequence.<br>
><br>
> Now I simply keep track of previous packet PTS/DTS values and alter them<br>
> according to duration. But this approach can handle only PTS/DTS loss only<br>
> in presence of duration (which is not reliable also).<br>
><br>
> So, what is the best way to fix input stream PTS/DTS returned from<br>
> av_read_frame?<br>
><br>
> Yurii<br>
><br>
<br>
</div></div>Looks like the bug that should be reported.<br>
______________________________<wbr>_________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org" target="_blank">Libav-user@ffmpeg.org</a><br>
<a href="http://ffmpeg.org/mailman/listinfo/libav-user" rel="noreferrer" target="_blank">http://ffmpeg.org/mailman/list<wbr>info/libav-user</a></blockquote><div> </div></div></div><div class="gmail_extra">But FFmpeg somehow fixes these timestamps to provide consistent stream.</div><div class="gmail_extra"><br></div><div class="gmail_extra">Another oddity I've discovered with this test stream - FFmpeg is unable to create segmented files.</div><div class="gmail_extra">This command does not work:</div><div class="gmail_extra"><br></div><div class="gmail_extra">ffmpeg -i <a href="http://bitmovin-a.akamaihd.net/content/playhouse-vr/m3u8s/105560_video_1920_9000000.m3u8">http://bitmovin-a.akamaihd.net/content/playhouse-vr/m3u8s/105560_video_1920_9000000.m3u8</a> -c copy -map 0 -f segment -segment_format mp4 -segment_time 10 -reset_timestamps 1 part%03d.mp4<br></div><div class="gmail_extra"><br></div><div class="gmail_extra">it creates single file part000.mp4 and complains about missing PTS. But playback is perfect with VLC/ffplay.</div><div class="gmail_extra"><br></div>BTW, what is the best place to report this kind of bugs?<br><div><div class="gmail_extra"></div><div class="gmail_extra"></div><div class="gmail_extra"><br></div><div class="gmail_extra">Yurii<br></div></div></div>