2016-01-30 10:44 GMT+01:00 Stefano Sabatini <stefa...@gmail.com>: > On date Friday 2016-01-29 17:38:13 +0100, Martin Vignali encoded: > > 2016-01-29 12:35 GMT+01:00 Stefano Sabatini <stefa...@gmail.com>: > [...] > > > + AVDictionaryEntry * tcr = av_dict_get(s->metadata, "timecode", > > > NULL, 0); > > > > + if (tcr){ > > > > + if (s->nb_streams > 0){ > > > > > > > + rate = s->streams[0]->avg_frame_rate;//Get fps from > > > first stream > > > > > > this looks a bit arbitrary, why the first stream? > > > > > > > + err = av_timecode_init_from_string(&tc, rate, > > > tcr->value, s); > > > > + if (err < 0) > > > > + return err; > > > > > > > + tc.start += (int)(seg->time / 1000000.) * > > > av_q2d(rate);//second count * fps > > > > > > You're losing precision here. Consider using the rescaling utilities > > > in libavutil/mathematics.h or something like (seg->time * rate.num) / > > > (rate.den * 1000000). > [...] > > Thanks you for your comments, i will make the modifications. > > > > For the fps issue, you're right, i use the first stream because in my > tests > > it's always the video stream. > > Is there a better way, to get fps ? without choosing one of the stream ? > > My guess is that timecode is always related to a video stream, right? > > In this case you can loop through the streams and selects the first > video stream (check also the select_reference_stream() function in > segment.c). > > I follow your proposal, and search the first video stream, to take fps.
In attach the new patch (and a documentation). Best regards Martin
0001-add-increment-timecode-option-using-segment-v2.patch
Description: Binary data
0002-doc-for-increment_tc-in-segment.patch
Description: Binary data
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel