Message ID | 05e36ec7-4458-4caf-b4cc-e6381b187e45@vivanet.hu |
---|---|
State | Superseded |
Headers | show |
2017-01-07 0:22 GMT+08:00 Bodecs Bela <bodecsb@vivanet.hu>: > > > 2017.01.06. 16:50 keltezéssel, Steven Liu írta: > >> 2017-01-06 22:07 GMT+08:00 Bodecs Bela <bodecsb@vivanet.hu>: >> >> Dear All, >>> >>> in avformat/hlsenc the start_number option starts the playlist sequence >>> number >>> (#EXT-X-MEDIA-SEQUENCE) from the specified number. Unless hls_flags >>> single_file is set, it also specifies starting sequence numbers of >>> segment and subtitle filenames. Sometimes it is usefull to have unique >>> starting numbers at each run, but currently it is only achiveable by >>> setting this parameter manually. >>> This patch enables to set start_number parameter automatically for >>> practically unique numbers. If start_number is set to -1, then >>> the start number will be the seconds since epoch (1970-01-01 00:00:00). >>> If set to -2, then the start number will be based on the current >>> date/time value as YYYYmmddHHMMSS. e.g. 20161231235659. >>> >>> >>> thank you, >>> >>> Bela Bodecs >>> >>> >>> _______________________________________________ >>> ffmpeg-devel mailing list >>> ffmpeg-devel@ffmpeg.org >>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >>> >>> >>> Two question: >> 1. char b[21]; Why this is 21 ? >> > you are right, 15 is enough. > >> 2. + {"start_number", "set first number in the sequence", >> OFFSET(start_sequence),AV_OPT_TYPE_INT64, {.i64 = 0}, -2, >> INT64_MAX, >> E}, >> Why is this -2 and the help message maybe need more infomation, for >> example >> -2 mean -1 mean 0 mean, and default value. >> > yes, I have altered now but I have written verbosly into the doc > (muxers.texi), here: > > +If set to -1, then the start number will be the seconds since epoch > (1970-01-01 00:00:00). > +If set to -2, then the start number will be based on the current > date/time as YYYYmmddHHMMSS. e.g. 20161231235759. > +Default value is 0. > > _______________________________________________ >> ffmpeg-devel mailing list >> ffmpeg-devel@ffmpeg.org >> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >> > I have enclosed a fixed version. A have changed some code, where greater > than 32 bit long sequence numbers were not handled correctly. > (av_get_frame_filename2) > > thank you. > Bela Bodecs > > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > + {"start_number", "set first number in the sequence, 0 is default, -1: second since epoch, -2: current datetime as YYYYMMDDhhmmss, actual value otherwise", OFFSET(start_sequence),AV_OPT_TYPE_INT64, {.i64 = 0}, -2, INT64_MAX, E}, I have check this option, i think add flag to control the start_number maybe better, for example: hls_flags hls_playlist_type maybe add a start_number_flags is better, What about you think?
2017.01.06. 17:33 keltezéssel, Steven Liu írta: > 2017-01-07 0:22 GMT+08:00 Bodecs Bela <bodecsb@vivanet.hu>: > >> >> 2017.01.06. 16:50 keltezéssel, Steven Liu írta: >> >>> 2017-01-06 22:07 GMT+08:00 Bodecs Bela <bodecsb@vivanet.hu>: >>> >>> Dear All, >>>> in avformat/hlsenc the start_number option starts the playlist sequence >>>> number >>>> (#EXT-X-MEDIA-SEQUENCE) from the specified number. Unless hls_flags >>>> single_file is set, it also specifies starting sequence numbers of >>>> segment and subtitle filenames. Sometimes it is usefull to have unique >>>> starting numbers at each run, but currently it is only achiveable by >>>> setting this parameter manually. >>>> This patch enables to set start_number parameter automatically for >>>> practically unique numbers. If start_number is set to -1, then >>>> the start number will be the seconds since epoch (1970-01-01 00:00:00). >>>> If set to -2, then the start number will be based on the current >>>> date/time value as YYYYmmddHHMMSS. e.g. 20161231235659. >>>> >>>> >>>> thank you, >>>> >>>> Bela Bodecs >>>> >>>> >>>> _______________________________________________ >>>> ffmpeg-devel mailing list >>>> ffmpeg-devel@ffmpeg.org >>>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >>>> >>>> >>>> Two question: >>> 1. char b[21]; Why this is 21 ? >>> >> you are right, 15 is enough. >> >>> 2. + {"start_number", "set first number in the sequence", >>> OFFSET(start_sequence),AV_OPT_TYPE_INT64, {.i64 = 0}, -2, >>> INT64_MAX, >>> E}, >>> Why is this -2 and the help message maybe need more infomation, for >>> example >>> -2 mean -1 mean 0 mean, and default value. >>> >> yes, I have altered now but I have written verbosly into the doc >> (muxers.texi), here: >> >> +If set to -1, then the start number will be the seconds since epoch >> (1970-01-01 00:00:00). >> +If set to -2, then the start number will be based on the current >> date/time as YYYYmmddHHMMSS. e.g. 20161231235759. >> +Default value is 0. >> >> _______________________________________________ >>> ffmpeg-devel mailing list >>> ffmpeg-devel@ffmpeg.org >>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >>> >> I have enclosed a fixed version. A have changed some code, where greater >> than 32 bit long sequence numbers were not handled correctly. >> (av_get_frame_filename2) >> >> thank you. >> Bela Bodecs >> >> >> _______________________________________________ >> ffmpeg-devel mailing list >> ffmpeg-devel@ffmpeg.org >> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >> >> > + {"start_number", "set first number in the sequence, 0 is default, -1: > second since epoch, -2: current datetime as YYYYMMDDhhmmss, actual value > otherwise", OFFSET(start_sequence),AV_OPT_TYPE_INT64, {.i64 = 0}, -2, > INT64_MAX, E}, > > I have check this option, i think add flag to control the start_number > maybe better, > for example: > hls_flags > hls_playlist_type > > maybe add a start_number_flags is better, What about you think? Using hls_flags is not enough to specify different values for them. I thought that there should be 3 options beside this start_number option. hls_start_number_playlist, hls_start_number_segment and hls_start_number_vtt Using start_number and any of the new 3 ones would be mutualy exlusive. This way anybody could use the old option (start_number) and it won't break the current behaviour. But those who want to have finer control, they may use the new options. of course -start_number x has the same effect as using -hls_start_number_playlist x -hls_start_number_segment x -hls_start_number_vtt x > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
2017-01-07 0:47 GMT+08:00 Bodecs Bela <bodecsb@vivanet.hu>: > > > 2017.01.06. 17:33 keltezéssel, Steven Liu írta: > >> 2017-01-07 0:22 GMT+08:00 Bodecs Bela <bodecsb@vivanet.hu>: >> >> >>> 2017.01.06. 16:50 keltezéssel, Steven Liu írta: >>> >>> 2017-01-06 22:07 GMT+08:00 Bodecs Bela <bodecsb@vivanet.hu>: >>>> >>>> Dear All, >>>> >>>>> in avformat/hlsenc the start_number option starts the playlist sequence >>>>> number >>>>> (#EXT-X-MEDIA-SEQUENCE) from the specified number. Unless hls_flags >>>>> single_file is set, it also specifies starting sequence numbers of >>>>> segment and subtitle filenames. Sometimes it is usefull to have unique >>>>> starting numbers at each run, but currently it is only achiveable by >>>>> setting this parameter manually. >>>>> This patch enables to set start_number parameter automatically for >>>>> practically unique numbers. If start_number is set to -1, then >>>>> the start number will be the seconds since epoch (1970-01-01 00:00:00). >>>>> If set to -2, then the start number will be based on the current >>>>> date/time value as YYYYmmddHHMMSS. e.g. 20161231235659. >>>>> >>>>> >>>>> thank you, >>>>> >>>>> Bela Bodecs >>>>> >>>>> >>>>> _______________________________________________ >>>>> ffmpeg-devel mailing list >>>>> ffmpeg-devel@ffmpeg.org >>>>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >>>>> >>>>> >>>>> Two question: >>>>> >>>> 1. char b[21]; Why this is 21 ? >>>> >>>> you are right, 15 is enough. >>> >>> 2. + {"start_number", "set first number in the sequence", >>>> OFFSET(start_sequence),AV_OPT_TYPE_INT64, {.i64 = 0}, -2, >>>> INT64_MAX, >>>> E}, >>>> Why is this -2 and the help message maybe need more infomation, for >>>> example >>>> -2 mean -1 mean 0 mean, and default value. >>>> >>>> yes, I have altered now but I have written verbosly into the doc >>> (muxers.texi), here: >>> >>> +If set to -1, then the start number will be the seconds since epoch >>> (1970-01-01 00:00:00). >>> +If set to -2, then the start number will be based on the current >>> date/time as YYYYmmddHHMMSS. e.g. 20161231235759. >>> +Default value is 0. >>> >>> _______________________________________________ >>> >>>> ffmpeg-devel mailing list >>>> ffmpeg-devel@ffmpeg.org >>>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >>>> >>>> I have enclosed a fixed version. A have changed some code, where greater >>> than 32 bit long sequence numbers were not handled correctly. >>> (av_get_frame_filename2) >>> >>> thank you. >>> Bela Bodecs >>> >>> >>> _______________________________________________ >>> ffmpeg-devel mailing list >>> ffmpeg-devel@ffmpeg.org >>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >>> >>> >>> + {"start_number", "set first number in the sequence, 0 is default, >> -1: >> second since epoch, -2: current datetime as YYYYMMDDhhmmss, actual value >> otherwise", OFFSET(start_sequence),AV_OPT_TYPE_INT64, {.i64 = 0}, >> -2, >> INT64_MAX, E}, >> >> I have check this option, i think add flag to control the start_number >> maybe better, >> for example: >> hls_flags >> hls_playlist_type >> >> maybe add a start_number_flags is better, What about you think? >> > > Using hls_flags is not enough to specify different values for them. > NO, i am not mean use hls_flags, i mean you can creat a new flags, start_number_flags generic epoch datetime I thought that there should be 3 options beside this start_number option. > hls_start_number_playlist, hls_start_number_segment and > hls_start_number_vtt > Using start_number and any of the new 3 ones would be mutualy exlusive. > > This way anybody could use the old option (start_number) and it won't > break the current behaviour. > But those who want to have finer control, they may use the new options. > > of course -start_number x has the same effect as using > -hls_start_number_playlist x -hls_start_number_segment x > -hls_start_number_vtt x > > > > _______________________________________________ >> ffmpeg-devel mailing list >> ffmpeg-devel@ffmpeg.org >> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >> > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >
2017.01.07. 0:32 keltezéssel, Steven Liu írta: > 2017-01-07 0:47 GMT+08:00 Bodecs Bela <bodecsb@vivanet.hu>: > >> >> 2017.01.06. 17:33 keltezéssel, Steven Liu írta: >> >>> 2017-01-07 0:22 GMT+08:00 Bodecs Bela <bodecsb@vivanet.hu>: >>> >>> >>>> 2017.01.06. 16:50 keltezéssel, Steven Liu írta: >>>> >>>> 2017-01-06 22:07 GMT+08:00 Bodecs Bela <bodecsb@vivanet.hu>: >>>>> Dear All, >>>>> >>>>>> in avformat/hlsenc the start_number option starts the playlist sequence >>>>>> number >>>>>> (#EXT-X-MEDIA-SEQUENCE) from the specified number. Unless hls_flags >>>>>> single_file is set, it also specifies starting sequence numbers of >>>>>> segment and subtitle filenames. Sometimes it is usefull to have unique >>>>>> starting numbers at each run, but currently it is only achiveable by >>>>>> setting this parameter manually. >>>>>> This patch enables to set start_number parameter automatically for >>>>>> practically unique numbers. If start_number is set to -1, then >>>>>> the start number will be the seconds since epoch (1970-01-01 00:00:00). >>>>>> If set to -2, then the start number will be based on the current >>>>>> date/time value as YYYYmmddHHMMSS. e.g. 20161231235659. >>>>>> >>>>>> >>>>>> thank you, >>>>>> >>>>>> Bela Bodecs >>>>>> >>>>>> >>>>>> _______________________________________________ >>>>>> ffmpeg-devel mailing list >>>>>> ffmpeg-devel@ffmpeg.org >>>>>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >>>>>> >>>>>> >>>>>> Two question: >>>>>> >>>>> 1. char b[21]; Why this is 21 ? >>>>> >>>>> you are right, 15 is enough. >>>> 2. + {"start_number", "set first number in the sequence", >>>>> OFFSET(start_sequence),AV_OPT_TYPE_INT64, {.i64 = 0}, -2, >>>>> INT64_MAX, >>>>> E}, >>>>> Why is this -2 and the help message maybe need more infomation, for >>>>> example >>>>> -2 mean -1 mean 0 mean, and default value. >>>>> >>>>> yes, I have altered now but I have written verbosly into the doc >>>> (muxers.texi), here: >>>> >>>> +If set to -1, then the start number will be the seconds since epoch >>>> (1970-01-01 00:00:00). >>>> +If set to -2, then the start number will be based on the current >>>> date/time as YYYYmmddHHMMSS. e.g. 20161231235759. >>>> +Default value is 0. >>>> >>>> _______________________________________________ >>>> >>>>> ffmpeg-devel mailing list >>>>> ffmpeg-devel@ffmpeg.org >>>>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >>>>> >>>>> I have enclosed a fixed version. A have changed some code, where greater >>>> than 32 bit long sequence numbers were not handled correctly. >>>> (av_get_frame_filename2) >>>> >>>> thank you. >>>> Bela Bodecs >>>> >>>> >>>> _______________________________________________ >>>> ffmpeg-devel mailing list >>>> ffmpeg-devel@ffmpeg.org >>>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >>>> >>>> >>>> + {"start_number", "set first number in the sequence, 0 is default, >>> -1: >>> second since epoch, -2: current datetime as YYYYMMDDhhmmss, actual value >>> otherwise", OFFSET(start_sequence),AV_OPT_TYPE_INT64, {.i64 = 0}, >>> -2, >>> INT64_MAX, E}, >>> >>> I have check this option, i think add flag to control the start_number >>> maybe better, >>> for example: >>> hls_flags >>> hls_playlist_type >>> >>> maybe add a start_number_flags is better, What about you think? >>> >> Using hls_flags is not enough to specify different values for them. >> > NO, i am not mean use hls_flags, i mean you can creat a new flags, > > start_number_flags > generic > epoch > datetime Ok, I see it. May I implement it? > > I thought that there should be 3 options beside this start_number option. >> hls_start_number_playlist, hls_start_number_segment and >> hls_start_number_vtt >> Using start_number and any of the new 3 ones would be mutualy exlusive. >> >> This way anybody could use the old option (start_number) and it won't >> break the current behaviour. >> But those who want to have finer control, they may use the new options. >> >> of course -start_number x has the same effect as using >> -hls_start_number_playlist x -hls_start_number_segment x >> -hls_start_number_vtt x >> >> >> >> _______________________________________________ >>> ffmpeg-devel mailing list >>> ffmpeg-devel@ffmpeg.org >>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >>> >> _______________________________________________ >> ffmpeg-devel mailing list >> ffmpeg-devel@ffmpeg.org >> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >> > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
2017-01-08 1:37 GMT+08:00 Bodecs Bela <bodecsb@vivanet.hu>: > > > 2017.01.07. 0:32 keltezéssel, Steven Liu írta: > >> 2017-01-07 0:47 GMT+08:00 Bodecs Bela <bodecsb@vivanet.hu>: >> >> >>> 2017.01.06. 17:33 keltezéssel, Steven Liu írta: >>> >>> 2017-01-07 0:22 GMT+08:00 Bodecs Bela <bodecsb@vivanet.hu>: >>>> >>>> >>>> 2017.01.06. 16:50 keltezéssel, Steven Liu írta: >>>>> >>>>> 2017-01-06 22:07 GMT+08:00 Bodecs Bela <bodecsb@vivanet.hu>: >>>>> >>>>>> Dear All, >>>>>> >>>>>> in avformat/hlsenc the start_number option starts the playlist >>>>>>> sequence >>>>>>> number >>>>>>> (#EXT-X-MEDIA-SEQUENCE) from the specified number. Unless hls_flags >>>>>>> single_file is set, it also specifies starting sequence numbers of >>>>>>> segment and subtitle filenames. Sometimes it is usefull to have >>>>>>> unique >>>>>>> starting numbers at each run, but currently it is only achiveable by >>>>>>> setting this parameter manually. >>>>>>> This patch enables to set start_number parameter automatically for >>>>>>> practically unique numbers. If start_number is set to -1, then >>>>>>> the start number will be the seconds since epoch (1970-01-01 >>>>>>> 00:00:00). >>>>>>> If set to -2, then the start number will be based on the current >>>>>>> date/time value as YYYYmmddHHMMSS. e.g. 20161231235659. >>>>>>> >>>>>>> >>>>>>> thank you, >>>>>>> >>>>>>> Bela Bodecs >>>>>>> >>>>>>> >>>>>>> _______________________________________________ >>>>>>> ffmpeg-devel mailing list >>>>>>> ffmpeg-devel@ffmpeg.org >>>>>>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >>>>>>> >>>>>>> >>>>>>> Two question: >>>>>>> >>>>>>> 1. char b[21]; Why this is 21 ? >>>>>> >>>>>> you are right, 15 is enough. >>>>>> >>>>> 2. + {"start_number", "set first number in the sequence", >>>>> >>>>>> OFFSET(start_sequence),AV_OPT_TYPE_INT64, {.i64 = 0}, -2, >>>>>> INT64_MAX, >>>>>> E}, >>>>>> Why is this -2 and the help message maybe need more infomation, for >>>>>> example >>>>>> -2 mean -1 mean 0 mean, and default value. >>>>>> >>>>>> yes, I have altered now but I have written verbosly into the doc >>>>>> >>>>> (muxers.texi), here: >>>>> >>>>> +If set to -1, then the start number will be the seconds since epoch >>>>> (1970-01-01 00:00:00). >>>>> +If set to -2, then the start number will be based on the current >>>>> date/time as YYYYmmddHHMMSS. e.g. 20161231235759. >>>>> +Default value is 0. >>>>> >>>>> _______________________________________________ >>>>> >>>>> ffmpeg-devel mailing list >>>>>> ffmpeg-devel@ffmpeg.org >>>>>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >>>>>> >>>>>> I have enclosed a fixed version. A have changed some code, where >>>>>> greater >>>>>> >>>>> than 32 bit long sequence numbers were not handled correctly. >>>>> (av_get_frame_filename2) >>>>> >>>>> thank you. >>>>> Bela Bodecs >>>>> >>>>> >>>>> _______________________________________________ >>>>> ffmpeg-devel mailing list >>>>> ffmpeg-devel@ffmpeg.org >>>>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >>>>> >>>>> >>>>> + {"start_number", "set first number in the sequence, 0 is default, >>>>> >>>> -1: >>>> second since epoch, -2: current datetime as YYYYMMDDhhmmss, actual value >>>> otherwise", OFFSET(start_sequence),AV_OPT_TYPE_INT64, {.i64 = 0}, >>>> -2, >>>> INT64_MAX, E}, >>>> >>>> I have check this option, i think add flag to control the start_number >>>> maybe better, >>>> for example: >>>> hls_flags >>>> hls_playlist_type >>>> >>>> maybe add a start_number_flags is better, What about you think? >>>> >>>> Using hls_flags is not enough to specify different values for them. >>> >>> NO, i am not mean use hls_flags, i mean you can creat a new flags, >> >> start_number_flags >> generic >> epoch >> datetime >> > Ok, I see it. May I implement it? > > yes, of course ;-) > > >> I thought that there should be 3 options beside this start_number option. >> >>> hls_start_number_playlist, hls_start_number_segment and >>> hls_start_number_vtt >>> Using start_number and any of the new 3 ones would be mutualy exlusive. >>> >>> This way anybody could use the old option (start_number) and it won't >>> break the current behaviour. >>> But those who want to have finer control, they may use the new options. >>> >>> of course -start_number x has the same effect as using >>> -hls_start_number_playlist x -hls_start_number_segment x >>> -hls_start_number_vtt x >>> >>> >>> >>> _______________________________________________ >>> >>>> ffmpeg-devel mailing list >>>> ffmpeg-devel@ffmpeg.org >>>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >>>> >>>> _______________________________________________ >>> ffmpeg-devel mailing list >>> ffmpeg-devel@ffmpeg.org >>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >>> >>> _______________________________________________ >> ffmpeg-devel mailing list >> ffmpeg-devel@ffmpeg.org >> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >> > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >
2017-01-08 8:22 GMT+08:00 Steven Liu <lingjiujianke@gmail.com>: > > > 2017-01-08 1:37 GMT+08:00 Bodecs Bela <bodecsb@vivanet.hu>: > >> >> >> 2017.01.07. 0:32 keltezéssel, Steven Liu írta: >> >>> 2017-01-07 0:47 GMT+08:00 Bodecs Bela <bodecsb@vivanet.hu>: >>> >>> >>>> 2017.01.06. 17:33 keltezéssel, Steven Liu írta: >>>> >>>> 2017-01-07 0:22 GMT+08:00 Bodecs Bela <bodecsb@vivanet.hu>: >>>>> >>>>> >>>>> 2017.01.06. 16:50 keltezéssel, Steven Liu írta: >>>>>> >>>>>> 2017-01-06 22:07 GMT+08:00 Bodecs Bela <bodecsb@vivanet.hu>: >>>>>> >>>>>>> Dear All, >>>>>>> >>>>>>> in avformat/hlsenc the start_number option starts the playlist >>>>>>>> sequence >>>>>>>> number >>>>>>>> (#EXT-X-MEDIA-SEQUENCE) from the specified number. Unless hls_flags >>>>>>>> single_file is set, it also specifies starting sequence numbers of >>>>>>>> segment and subtitle filenames. Sometimes it is usefull to have >>>>>>>> unique >>>>>>>> starting numbers at each run, but currently it is only achiveable by >>>>>>>> setting this parameter manually. >>>>>>>> This patch enables to set start_number parameter automatically for >>>>>>>> practically unique numbers. If start_number is set to -1, then >>>>>>>> the start number will be the seconds since epoch (1970-01-01 >>>>>>>> 00:00:00). >>>>>>>> If set to -2, then the start number will be based on the current >>>>>>>> date/time value as YYYYmmddHHMMSS. e.g. 20161231235659. >>>>>>>> >>>>>>>> >>>>>>>> thank you, >>>>>>>> >>>>>>>> Bela Bodecs >>>>>>>> >>>>>>>> >>>>>>>> _______________________________________________ >>>>>>>> ffmpeg-devel mailing list >>>>>>>> ffmpeg-devel@ffmpeg.org >>>>>>>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >>>>>>>> >>>>>>>> >>>>>>>> Two question: >>>>>>>> >>>>>>>> 1. char b[21]; Why this is 21 ? >>>>>>> >>>>>>> you are right, 15 is enough. >>>>>>> >>>>>> 2. + {"start_number", "set first number in the sequence", >>>>>> >>>>>>> OFFSET(start_sequence),AV_OPT_TYPE_INT64, {.i64 = 0}, -2, >>>>>>> INT64_MAX, >>>>>>> E}, >>>>>>> Why is this -2 and the help message maybe need more infomation, for >>>>>>> example >>>>>>> -2 mean -1 mean 0 mean, and default value. >>>>>>> >>>>>>> yes, I have altered now but I have written verbosly into the doc >>>>>>> >>>>>> (muxers.texi), here: >>>>>> >>>>>> +If set to -1, then the start number will be the seconds since epoch >>>>>> (1970-01-01 00:00:00). >>>>>> +If set to -2, then the start number will be based on the current >>>>>> date/time as YYYYmmddHHMMSS. e.g. 20161231235759. >>>>>> +Default value is 0. >>>>>> >>>>>> _______________________________________________ >>>>>> >>>>>> ffmpeg-devel mailing list >>>>>>> ffmpeg-devel@ffmpeg.org >>>>>>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >>>>>>> >>>>>>> I have enclosed a fixed version. A have changed some code, where >>>>>>> greater >>>>>>> >>>>>> than 32 bit long sequence numbers were not handled correctly. >>>>>> (av_get_frame_filename2) >>>>>> >>>>>> thank you. >>>>>> Bela Bodecs >>>>>> >>>>>> >>>>>> _______________________________________________ >>>>>> ffmpeg-devel mailing list >>>>>> ffmpeg-devel@ffmpeg.org >>>>>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >>>>>> >>>>>> >>>>>> + {"start_number", "set first number in the sequence, 0 is >>>>>> default, >>>>>> >>>>> -1: >>>>> second since epoch, -2: current datetime as YYYYMMDDhhmmss, actual >>>>> value >>>>> otherwise", OFFSET(start_sequence),AV_OPT_TYPE_INT64, {.i64 = 0}, >>>>> -2, >>>>> INT64_MAX, E}, >>>>> >>>>> I have check this option, i think add flag to control the start_number >>>>> maybe better, >>>>> for example: >>>>> hls_flags >>>>> hls_playlist_type >>>>> >>>>> maybe add a start_number_flags is better, What about you think? >>>>> >>>>> Using hls_flags is not enough to specify different values for them. >>>> >>>> NO, i am not mean use hls_flags, i mean you can creat a new flags, >>> >>> start_number_flags >>> generic >>> epoch >>> datetime >>> >> Ok, I see it. May I implement it? >> >> > yes, of course ;-) > >> >> >>> I thought that there should be 3 options beside this start_number option. >>> >>>> hls_start_number_playlist, hls_start_number_segment and >>>> hls_start_number_vtt >>>> Using start_number and any of the new 3 ones would be mutualy exlusive. >>>> >>>> This way anybody could use the old option (start_number) and it won't >>>> break the current behaviour. >>>> But those who want to have finer control, they may use the new options. >>>> >>>> of course -start_number x has the same effect as using >>>> -hls_start_number_playlist x -hls_start_number_segment x >>>> -hls_start_number_vtt x >>>> >>>> >>>> >>>> _______________________________________________ >>>> >>>>> ffmpeg-devel mailing list >>>>> ffmpeg-devel@ffmpeg.org >>>>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >>>>> >>>>> _______________________________________________ >>>> ffmpeg-devel mailing list >>>> ffmpeg-devel@ffmpeg.org >>>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >>>> >>>> _______________________________________________ >>> ffmpeg-devel mailing list >>> ffmpeg-devel@ffmpeg.org >>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >>> >> >> _______________________________________________ >> ffmpeg-devel mailing list >> ffmpeg-devel@ffmpeg.org >> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >> > > Hi Bodecs, If you don't have enough time, i think i can do it together with you;)
2017.01.10. 6:53 keltezéssel, Steven Liu írta: > 2017-01-08 8:22 GMT+08:00 Steven Liu <lingjiujianke@gmail.com>: > >> >> 2017-01-08 1:37 GMT+08:00 Bodecs Bela <bodecsb@vivanet.hu>: >> >>> >>> 2017.01.07. 0:32 keltezéssel, Steven Liu írta: >>> >>>> 2017-01-07 0:47 GMT+08:00 Bodecs Bela <bodecsb@vivanet.hu>: >>>> >>>> >>>>> 2017.01.06. 17:33 keltezéssel, Steven Liu írta: >>>>> >>>>> 2017-01-07 0:22 GMT+08:00 Bodecs Bela <bodecsb@vivanet.hu>: >>>>>> >>>>>> 2017.01.06. 16:50 keltezéssel, Steven Liu írta: >>>>>>> 2017-01-06 22:07 GMT+08:00 Bodecs Bela <bodecsb@vivanet.hu>: >>>>>>> >>>>>>>> Dear All, >>>>>>>> >>>>>>>> in avformat/hlsenc the start_number option starts the playlist >>>>>>>>> sequence >>>>>>>>> number >>>>>>>>> (#EXT-X-MEDIA-SEQUENCE) from the specified number. Unless hls_flags >>>>>>>>> single_file is set, it also specifies starting sequence numbers of >>>>>>>>> segment and subtitle filenames. Sometimes it is usefull to have >>>>>>>>> unique >>>>>>>>> starting numbers at each run, but currently it is only achiveable by >>>>>>>>> setting this parameter manually. >>>>>>>>> This patch enables to set start_number parameter automatically for >>>>>>>>> practically unique numbers. If start_number is set to -1, then >>>>>>>>> the start number will be the seconds since epoch (1970-01-01 >>>>>>>>> 00:00:00). >>>>>>>>> If set to -2, then the start number will be based on the current >>>>>>>>> date/time value as YYYYmmddHHMMSS. e.g. 20161231235659. >>>>>>>>> >>>>>>>>> >>>>>>>>> thank you, >>>>>>>>> >>>>>>>>> Bela Bodecs >>>>>>>>> >>>>>>>>> >>>>>>>>> _______________________________________________ >>>>>>>>> ffmpeg-devel mailing list >>>>>>>>> ffmpeg-devel@ffmpeg.org >>>>>>>>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >>>>>>>>> >>>>>>>>> >>>>>>>>> Two question: >>>>>>>>> >>>>>>>>> 1. char b[21]; Why this is 21 ? >>>>>>>> you are right, 15 is enough. >>>>>>>> >>>>>>> 2. + {"start_number", "set first number in the sequence", >>>>>>> >>>>>>>> OFFSET(start_sequence),AV_OPT_TYPE_INT64, {.i64 = 0}, -2, >>>>>>>> INT64_MAX, >>>>>>>> E}, >>>>>>>> Why is this -2 and the help message maybe need more infomation, for >>>>>>>> example >>>>>>>> -2 mean -1 mean 0 mean, and default value. >>>>>>>> >>>>>>>> yes, I have altered now but I have written verbosly into the doc >>>>>>>> >>>>>>> (muxers.texi), here: >>>>>>> >>>>>>> +If set to -1, then the start number will be the seconds since epoch >>>>>>> (1970-01-01 00:00:00). >>>>>>> +If set to -2, then the start number will be based on the current >>>>>>> date/time as YYYYmmddHHMMSS. e.g. 20161231235759. >>>>>>> +Default value is 0. >>>>>>> >>>>>>> _______________________________________________ >>>>>>> >>>>>>> ffmpeg-devel mailing list >>>>>>>> ffmpeg-devel@ffmpeg.org >>>>>>>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >>>>>>>> >>>>>>>> I have enclosed a fixed version. A have changed some code, where >>>>>>>> greater >>>>>>>> >>>>>>> than 32 bit long sequence numbers were not handled correctly. >>>>>>> (av_get_frame_filename2) >>>>>>> >>>>>>> thank you. >>>>>>> Bela Bodecs >>>>>>> >>>>>>> >>>>>>> _______________________________________________ >>>>>>> ffmpeg-devel mailing list >>>>>>> ffmpeg-devel@ffmpeg.org >>>>>>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >>>>>>> >>>>>>> >>>>>>> + {"start_number", "set first number in the sequence, 0 is >>>>>>> default, >>>>>>> >>>>>> -1: >>>>>> second since epoch, -2: current datetime as YYYYMMDDhhmmss, actual >>>>>> value >>>>>> otherwise", OFFSET(start_sequence),AV_OPT_TYPE_INT64, {.i64 = 0}, >>>>>> -2, >>>>>> INT64_MAX, E}, >>>>>> >>>>>> I have check this option, i think add flag to control the start_number >>>>>> maybe better, >>>>>> for example: >>>>>> hls_flags >>>>>> hls_playlist_type >>>>>> >>>>>> maybe add a start_number_flags is better, What about you think? >>>>>> >>>>>> Using hls_flags is not enough to specify different values for them. >>>>> NO, i am not mean use hls_flags, i mean you can creat a new flags, >>>> start_number_flags >>>> generic >>>> epoch >>>> datetime >>>> >>> Ok, I see it. May I implement it? >>> >>> >> yes, of course ;-) >> >>> >>>> I thought that there should be 3 options beside this start_number option. >>>> >>>>> hls_start_number_playlist, hls_start_number_segment and >>>>> hls_start_number_vtt >>>>> Using start_number and any of the new 3 ones would be mutualy exlusive. >>>>> >>>>> This way anybody could use the old option (start_number) and it won't >>>>> break the current behaviour. >>>>> But those who want to have finer control, they may use the new options. >>>>> >>>>> of course -start_number x has the same effect as using >>>>> -hls_start_number_playlist x -hls_start_number_segment x >>>>> -hls_start_number_vtt x >>>>> >>>>> >>>>> >>>>> _______________________________________________ >>>>> >>>>>> ffmpeg-devel mailing list >>>>>> ffmpeg-devel@ffmpeg.org >>>>>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >>>>>> >>>>>> _______________________________________________ >>>>> ffmpeg-devel mailing list >>>>> ffmpeg-devel@ffmpeg.org >>>>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >>>>> >>>>> _______________________________________________ >>>> ffmpeg-devel mailing list >>>> ffmpeg-devel@ffmpeg.org >>>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >>>> >>> _______________________________________________ >>> ffmpeg-devel mailing list >>> ffmpeg-devel@ffmpeg.org >>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel >>> >> > Hi Bodecs, > > If you don't have enough time, i think i can do it together with > you;) I have done it yesterday. I will send it very soon. > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
From 4560890d877af6d3e2f10a499c0cfd847ded8f37 Mon Sep 17 00:00:00 2001 From: Bela Bodecs <bodecsb@vivanet.hu> Date: Fri, 6 Jan 2017 14:52:08 +0100 Subject: [PATCH] avformat/hlsenc: start_number new options start_number option starts the playlist sequence number (#EXT-X-MEDIA-SEQUENCE) from the specified number. Unless hls_flags single_file is set, it also specifies starting sequence numbers of segment and subtitle filenames. Sometimes it is usefull to have unique starting numbers at each run, but currently it is only achiveable by setting this parameter manually. This patch enables to set start_number parameter automatically for practically unique numbers. If start_number is set to -1, then the start number will be the seconds since epoch (1970-01-01 00:00:00). If set to -2, then the start number will be based on the current date/time value as YYYYmmddHHMMSS. e.g. 20161231235659. Hls speficication allow 64 bit integers as sequence numbers. This patch changes some code where only 32 bit integer values were handled. Signed-off-by: Bela Bodecs <bodecsb@vivanet.hu> --- doc/muxers.texi | 8 ++++++-- libavformat/hlsenc.c | 42 +++++++++++++++++++++++++++++++----------- 2 files changed, 37 insertions(+), 13 deletions(-) diff --git a/doc/muxers.texi b/doc/muxers.texi index 351cd8c..746f231 100644 --- a/doc/muxers.texi +++ b/doc/muxers.texi @@ -417,8 +417,12 @@ files, and limits the maximum number of segment files written to disk to @var{wrap}. @item start_number @var{number} -Start the playlist sequence number from @var{number}. Default value is -0. +Start the playlist sequence number (@code{#EXT-X-MEDIA-SEQUENCE}) from the specified @var{number}. +Unless @code{hls_flags single_file} is set, it also specifies starting sequence numbers of segment and subtitle filenames. +If set to -1, then the start number will be the seconds since epoch (1970-01-01 00:00:00). +If set to -2, then the start number will be based on the current date/time as YYYYmmddHHMMSS. e.g. 20161231235759. +Default value is 0. If @code{hls_flags append_list} is set and read playlist sequence number is greater than specified +@var{number}, then that value will be used as start_number value. @item hls_allow_cache @var{allowcache} Explicitly set whether the client MAY (1) or MUST NOT (0) cache media segments. diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index eeb450a..1679607 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -39,6 +39,9 @@ #include "internal.h" #include "os_support.h" +#define HLS_START_SEQUNCE_AS_SECONDS_SINCE_EPOCH -1 +#define HLS_START_SEQUNCE_AS_FORMATTED_STRFTIME -2 + #define KEYSIZE 16 #define LINE_BUFFER_SIZE 1024 @@ -586,7 +589,11 @@ static int parse_playlist(AVFormatContext *s, const char *url) while (!avio_feof(in)) { read_chomp_line(in, line, sizeof(line)); if (av_strstart(line, "#EXT-X-MEDIA-SEQUENCE:", &ptr)) { - hls->sequence = atoi(ptr); + int64_t tmp_sequence = strtoll(ptr, NULL, 10); + if (tmp_sequence < hls->sequence) + av_log(hls, AV_LOG_VERBOSE, "Found playlist sequence number was smaller than specified start_number: %"PRId64" < %"PRId64", omitting\n", tmp_sequence, hls->start_sequence); + else + hls->sequence = tmp_sequence; } else if (av_strstart(line, "#EXT-X-DISCONTINUITY", &ptr)) { is_segment = 1; hls->discontinuity = 1; @@ -797,9 +804,8 @@ static int hls_start(AVFormatContext *s) av_strlcpy(vtt_oc->filename, c->vtt_basename, sizeof(vtt_oc->filename)); } else if (c->max_seg_size > 0) { - if (av_get_frame_filename2(oc->filename, sizeof(oc->filename), - c->basename, c->wrap ? c->sequence % c->wrap : c->sequence, - AV_FRAME_FILENAME_FLAGS_MULTIPLE) < 0) { + if (replace_int_data_in_filename(oc->filename, sizeof(oc->filename), + c->basename, 'd', c->wrap ? c->sequence % c->wrap : c->sequence) < 1) { av_log(oc, AV_LOG_ERROR, "Invalid segment filename template '%s', you can try to use -use_localtime 1 with it\n", c->basename); return AVERROR(EINVAL); } @@ -874,16 +880,14 @@ static int hls_start(AVFormatContext *s) } av_free(fn_copy); } - } else if (av_get_frame_filename2(oc->filename, sizeof(oc->filename), - c->basename, c->wrap ? c->sequence % c->wrap : c->sequence, - AV_FRAME_FILENAME_FLAGS_MULTIPLE) < 0) { + } else if (replace_int_data_in_filename(oc->filename, sizeof(oc->filename), + c->basename, 'd', c->wrap ? c->sequence % c->wrap : c->sequence) < 1) { av_log(oc, AV_LOG_ERROR, "Invalid segment filename template '%s' you can try to use -use_localtime 1 with it\n", c->basename); return AVERROR(EINVAL); } if( c->vtt_basename) { - if (av_get_frame_filename2(vtt_oc->filename, sizeof(vtt_oc->filename), - c->vtt_basename, c->wrap ? c->sequence % c->wrap : c->sequence, - AV_FRAME_FILENAME_FLAGS_MULTIPLE) < 0) { + if (replace_int_data_in_filename(vtt_oc->filename, sizeof(vtt_oc->filename), + c->vtt_basename, 'd', c->wrap ? c->sequence % c->wrap : c->sequence) < 1) { av_log(vtt_oc, AV_LOG_ERROR, "Invalid segment filename template '%s'\n", c->vtt_basename); return AVERROR(EINVAL); } @@ -971,6 +975,22 @@ static int hls_write_header(AVFormatContext *s) int basename_size; int vtt_basename_size; + if (hls->start_sequence == HLS_START_SEQUNCE_AS_SECONDS_SINCE_EPOCH || hls->start_sequence == HLS_START_SEQUNCE_AS_FORMATTED_STRFTIME) { + time_t t = time(NULL); // we will need it in either case + if (hls->start_sequence == HLS_START_SEQUNCE_AS_SECONDS_SINCE_EPOCH) { + hls->start_sequence = (int64_t)t; + } else if (hls->start_sequence == HLS_START_SEQUNCE_AS_FORMATTED_STRFTIME) { + char b[15]; + struct tm *p, tmbuf; + if (!(p = localtime_r(&t, &tmbuf))) + return AVERROR(ENOMEM); + if (!strftime(b, sizeof(b), "%Y%m%d%H%M%S", p)) + return AVERROR(ENOMEM); + hls->start_sequence = strtoll(b, NULL, 10); + } + av_log(hls, AV_LOG_DEBUG, "start_number evaluated to %"PRId64"\n", hls->start_sequence); + } + hls->sequence = hls->start_sequence; hls->recording_time = (hls->init_time ? hls->init_time : hls->time) * AV_TIME_BASE; hls->start_pts = AV_NOPTS_VALUE; @@ -1318,7 +1338,7 @@ static int hls_write_trailer(struct AVFormatContext *s) #define OFFSET(x) offsetof(HLSContext, x) #define E AV_OPT_FLAG_ENCODING_PARAM static const AVOption options[] = { - {"start_number", "set first number in the sequence", OFFSET(start_sequence),AV_OPT_TYPE_INT64, {.i64 = 0}, 0, INT64_MAX, E}, + {"start_number", "set first number in the sequence, 0 is default, -1: second since epoch, -2: current datetime as YYYYMMDDhhmmss, actual value otherwise", OFFSET(start_sequence),AV_OPT_TYPE_INT64, {.i64 = 0}, -2, INT64_MAX, E}, {"hls_time", "set segment length in seconds", OFFSET(time), AV_OPT_TYPE_FLOAT, {.dbl = 2}, 0, FLT_MAX, E}, {"hls_init_time", "set segment length in seconds at init list", OFFSET(init_time), AV_OPT_TYPE_FLOAT, {.dbl = 0}, 0, FLT_MAX, E}, {"hls_list_size", "set maximum number of playlist entries", OFFSET(max_nb_segments), AV_OPT_TYPE_INT, {.i64 = 5}, 0, INT_MAX, E}, -- 2.5.3.windows.1