[FFmpeg-devel,v4] avformat/movenc: Added an option to disable SIDX atom

Submitted by kjeyapal@akamai.com on Dec. 6, 2018, 7:28 a.m.

Details

Message ID 20181206072801.58323-1-kjeyapal@akamai.com
State New
Headers show

Commit Message

kjeyapal@akamai.com Dec. 6, 2018, 7:28 a.m.
---
 doc/muxers.texi      |  4 ++++
 libavformat/movenc.c | 12 ++++++++++--
 libavformat/movenc.h |  1 +
 3 files changed, 15 insertions(+), 2 deletions(-)

Comments

Tobias Rapp Dec. 6, 2018, 9:47 a.m.
On 06.12.2018 08:28, Karthick J wrote:
> ---
>   doc/muxers.texi      |  4 ++++
>   libavformat/movenc.c | 12 ++++++++++--
>   libavformat/movenc.h |  1 +
>   3 files changed, 15 insertions(+), 2 deletions(-)
>   
> [...]

Looks OK now, no more comments from my side.

Regards,
Tobias
Ronak Patel Dec. 11, 2018, 3:36 a.m.
> On Dec 6, 2018, at 4:47 AM, Tobias Rapp <t.rapp@noa-archive.com> wrote:
> 
> On 06.12.2018 08:28, Karthick J wrote:
>> ---
>>  doc/muxers.texi      |  4 ++++
>>  libavformat/movenc.c | 12 ++++++++++--
>>  libavformat/movenc.h |  1 +
>>  3 files changed, 15 insertions(+), 2 deletions(-)
>>  [...]
> 
> Looks OK now, no more comments from my side.

I actually was going to submit a patch that would remove sidx atoms being written out for any non-video content.

Is that now unnecessary because of your changes here?

So adding -movflags skip_sidx for our audio only fmp4 files would allow us to skip the sidx atoms?

Ronak

> 
> Regards,
> Tobias
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
kjeyapal@akamai.com Dec. 11, 2018, 5:32 a.m.
On 12/6/18, 3:18 PM, "Tobias Rapp" <t.rapp@noa-archive.com> wrote:
>

>On 06.12.2018 08:28, Karthick J wrote:

>> ---

>>   doc/muxers.texi      |  4 ++++

>>   libavformat/movenc.c | 12 ++++++++++--

>>   libavformat/movenc.h |  1 +

>>   3 files changed, 15 insertions(+), 2 deletions(-)

>>   

>> [...]

>

>Looks OK now, no more comments from my side.

Pushed.

Regards,
Karthick
>

>Regards,

>Tobias


_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
kjeyapal@akamai.com Dec. 11, 2018, 5:35 a.m.
On 12/11/18, 9:07 AM, "Ronak" <ronak2121-at-yahoo.com@ffmpeg.org> wrote:

>

>> On Dec 6, 2018, at 4:47 AM, Tobias Rapp <t.rapp@noa-archive.com> wrote:

>> 

>> On 06.12.2018 08:28, Karthick J wrote:

>>> ---

>>>  [...]

>> 

>> Looks OK now, no more comments from my side.

>

>I actually was going to submit a patch that would remove sidx atoms being written out for any non-video content.

>

>Is that now unnecessary because of your changes here?

>

>So adding -movflags skip_sidx for our audio only fmp4 files would allow us to skip the sidx atoms?

Yes
>

>Ronak

>

>> 

>> Regards,

>> Tobias
Ronak Patel Dec. 11, 2018, 6:42 p.m.
> On Dec 11, 2018, at 12:35 AM, Jeyapal, Karthick <kjeyapal@akamai.com> wrote:
> 
> 
> 
> On 12/11/18, 9:07 AM, "Ronak" <ronak2121-at-yahoo.com@ffmpeg.org> wrote:
> 
>> 
>>> On Dec 6, 2018, at 4:47 AM, Tobias Rapp <t.rapp@noa-archive.com> wrote:
>>> 
>>> On 06.12.2018 08:28, Karthick J wrote:
>>>> ---
>>>> [...]
>>> 
>>> Looks OK now, no more comments from my side.
>> 
>> I actually was going to submit a patch that would remove sidx atoms being written out for any non-video content.
>> 
>> Is that now unnecessary because of your changes here?
>> 
>> So adding -movflags skip_sidx for our audio only fmp4 files would allow us to skip the sidx atoms?
> Yes

Hey Tobias,


So I just pulled HEAD and tried to use your support, but I can't figure out how to engage it:

ffmpeg -i input.mp4 -codec copy -hls_time 0.97523809523809 -hls_segment_type fmp4 -hls_flags single_file -hls_playlist_type vod -movflags skip_sidx output.m3u8
ffmpeg -i input.mp4 -codec copy -hls_time 0.97523809523809 -hls_segment_type fmp4 -hls_flags single_file -hls_playlist_type vod -movflags skip_sidx=1 output.m3u8

None of these command lines produced an mp4 file without sidx atoms. The input.mp4 file is an audio only mp4 so I don't need sidx.


Ronak

>> 
>> Ronak
>> 
>>> 
>>> Regards,
>>> Tobias
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Ronak Patel Dec. 11, 2018, 7:43 p.m.
> On Dec 11, 2018, at 1:42 PM, Ronak <ronak2121@yahoo.com> wrote:
> 
> 
> 
>> On Dec 11, 2018, at 12:35 AM, Jeyapal, Karthick <kjeyapal@akamai.com> wrote:
>> 
>> 
>> 
>> On 12/11/18, 9:07 AM, "Ronak" <ronak2121-at-yahoo.com@ffmpeg.org> wrote:
>> 
>>> 
>>>> On Dec 6, 2018, at 4:47 AM, Tobias Rapp <t.rapp@noa-archive.com> wrote:
>>>> 
>>>> On 06.12.2018 08:28, Karthick J wrote:
>>>>> ---
>>>>> [...]
>>>> 
>>>> Looks OK now, no more comments from my side.
>>> 
>>> I actually was going to submit a patch that would remove sidx atoms being written out for any non-video content.
>>> 
>>> Is that now unnecessary because of your changes here?
>>> 
>>> So adding -movflags skip_sidx for our audio only fmp4 files would allow us to skip the sidx atoms?
>> Yes
> 
> Hey Tobias,
> 
> 
> So I just pulled HEAD and tried to use your support, but I can't figure out how to engage it:
> 
> ffmpeg -i input.mp4 -codec copy -hls_time 0.97523809523809 -hls_segment_type fmp4 -hls_flags single_file -hls_playlist_type vod -movflags skip_sidx output.m3u8
> ffmpeg -i input.mp4 -codec copy -hls_time 0.97523809523809 -hls_segment_type fmp4 -hls_flags single_file -hls_playlist_type vod -movflags skip_sidx=1 output.m3u8
> 
> None of these command lines produced an mp4 file without sidx atoms. The input.mp4 file is an audio only mp4 so I don't need sidx.
> 
> 

Looks like I found out why: https://github.com/FFmpeg/FFmpeg/blob/master/libavformat/hlsenc.c#L790. The hlsenc.c file overwrites whatever I pass in the command line...


> Ronak
> 
>>> 
>>> Ronak
>>> 
>>>> 
>>>> Regards,
>>>> Tobias
>> 
>> _______________________________________________
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org <mailto:ffmpeg-devel@ffmpeg.org>
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel <http://ffmpeg.org/mailman/listinfo/ffmpeg-devel>
Gyan Dec. 11, 2018, 8:28 p.m.
On 12-12-2018 01:13 AM, Ronak wrote:
>
> Looks like I found out why: 
> https://github.com/FFmpeg/FFmpeg/blob/master/libavformat/hlsenc.c#L790. 
> The hlsenc.c file overwrites whatever I pass in the command line...

That is a bug but there's still an error in your command. It should be,


     -hls_ts_options movflags=+skip_sidx

This is because mp4 is a child muxer in this context. That hls option 
should be renamed.

Line 790 should be patched by adding + before frag_custom

Gyan
Ronak Patel Dec. 11, 2018, 9:08 p.m.
> On Dec 11, 2018, at 3:28 PM, Gyan <ffmpeg@gyani.pro> wrote:
> 
> 
> On 12-12-2018 01:13 AM, Ronak wrote:
>> 
>> Looks like I found out why: https://github.com/FFmpeg/FFmpeg/blob/master/libavformat/hlsenc.c#L790. The hlsenc.c file overwrites whatever I pass in the command line...
> 
> That is a bug but there's still an error in your command. It should be,
> 
> 
>     -hls_ts_options movflags=+skip_sidx
> 
> This is because mp4 is a child muxer in this context. That hls option should be renamed.
> 
> Line 790 should be patched by adding + before frag_custom

That doesn't work.

ffmpeg -i input.mp4 -hls_ts_options movflags=+skip_sidx -codec copy -hls_time 0.97523809523809 -hls_segment_type fmp4 -hls_flags single_file -hls_playlist_type vod output.m3u8
ffmpeg version N-92677-gdd7d6034f1 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 4.4.6 (GCC) 20110731 (Red Hat 4.4.6-3)
  configuration: --prefix=/home/ronakp/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/ronakp/ffmpeg_build/include --extra-ldflags=-L/home/ronakp/ffmpeg_build/lib --extra-libs=-lpthread --extra-libs=-lm --bindir=/home/ronakp/bin --enable-gpl --enable-libfdk_aac --enable-libmp3lame --enable-libopus --enable-nonfree
  libavutil      56. 24.101 / 56. 24.101
  libavcodec     58. 42.100 / 58. 42.100
  libavformat    58. 24.100 / 58. 24.100
  libavdevice    58.  6.101 / 58.  6.101
  libavfilter     7. 46.101 /  7. 46.101
  libswscale      5.  4.100 /  5.  4.100
  libswresample   3.  4.100 /  3.  4.100
  libpostproc    55.  4.100 / 55.  4.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 1
    compatible_brands: isom
    creation_time   : 2013-11-14T18:23:26.000000Z
  Duration: 02:39:09.39, start: 0.000000, bitrate: 31 kb/s
    Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 22050 Hz, mono, fltp, 30 kb/s (default)
    Metadata:
      creation_time   : 2013-11-14T18:23:26.000000Z
      handler_name    : GPAC ISO Audio Handler
[hls @ 0x23e1b00] Opening 'output.m4s' for writing
[hls @ 0x23e1b00] Some of provided format options in 'movflags=+skip_sidx' are not recognized
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
    Last message repeated 1 times

Also, I think whatever options I set on the command line are going to be overwritten by line 790 in hlsenc.c anyway no?

> 
> Gyan
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Steven Liu Dec. 12, 2018, 7:46 a.m.
> 在 2018年12月12日,上午5:08,Ronak <ronak2121-at-yahoo.com@ffmpeg.org> 写道:
> 
>> 
>> On Dec 11, 2018, at 3:28 PM, Gyan <ffmpeg@gyani.pro> wrote:
>> 
>> 
>> On 12-12-2018 01:13 AM, Ronak wrote:
>>> 
>>> Looks like I found out why: https://github.com/FFmpeg/FFmpeg/blob/master/libavformat/hlsenc.c#L790. The hlsenc.c file overwrites whatever I pass in the command line...
>> 
>> That is a bug but there's still an error in your command. It should be,
>> 
>> 
>>    -hls_ts_options movflags=+skip_sidx
>> 
>> This is because mp4 is a child muxer in this context. That hls option should be renamed.
>> 
>> Line 790 should be patched by adding + before frag_custom
> 
> That doesn't work.
> 
> ffmpeg -i input.mp4 -hls_ts_options movflags=+skip_sidx -codec copy -hls_time 0.97523809523809 -hls_segment_type fmp4 -hls_flags single_file -hls_playlist_type vod output.m3u8
> ffmpeg version N-92677-gdd7d6034f1 Copyright (c) 2000-2018 the FFmpeg developers
>  built with gcc 4.4.6 (GCC) 20110731 (Red Hat 4.4.6-3)
>  configuration: --prefix=/home/ronakp/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/ronakp/ffmpeg_build/include --extra-ldflags=-L/home/ronakp/ffmpeg_build/lib --extra-libs=-lpthread --extra-libs=-lm --bindir=/home/ronakp/bin --enable-gpl --enable-libfdk_aac --enable-libmp3lame --enable-libopus --enable-nonfree
>  libavutil      56. 24.101 / 56. 24.101
>  libavcodec     58. 42.100 / 58. 42.100
>  libavformat    58. 24.100 / 58. 24.100
>  libavdevice    58.  6.101 / 58.  6.101
>  libavfilter     7. 46.101 /  7. 46.101
>  libswscale      5.  4.100 /  5.  4.100
>  libswresample   3.  4.100 /  3.  4.100
>  libpostproc    55.  4.100 / 55.  4.100
> Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mp4':
>  Metadata:
>    major_brand     : isom
>    minor_version   : 1
>    compatible_brands: isom
>    creation_time   : 2013-11-14T18:23:26.000000Z
>  Duration: 02:39:09.39, start: 0.000000, bitrate: 31 kb/s
>    Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 22050 Hz, mono, fltp, 30 kb/s (default)
>    Metadata:
>      creation_time   : 2013-11-14T18:23:26.000000Z
>      handler_name    : GPAC ISO Audio Handler
> [hls @ 0x23e1b00] Opening 'output.m4s' for writing
> [hls @ 0x23e1b00] Some of provided format options in 'movflags=+skip_sidx' are not recognized
> Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
> Stream mapping:
>  Stream #0:0 -> #0:0 (copy)
>    Last message repeated 1 times
> 
> Also, I think whatever options I set on the command line are going to be overwritten by line 790 in hlsenc.c anyway no?
https://patchwork.ffmpeg.org/patch/11378/

Try this patch please :D
> 
>> 
>> Gyan
>> 
>> _______________________________________________
>> 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
Ronak Patel Dec. 14, 2018, 2:15 a.m.
> On Dec 12, 2018, at 2:46 AM, Liu Steven <lq@chinaffmpeg.org> wrote:
> 
> 
> 
>>> 在 2018年12月12日,上午5:08,Ronak <ronak2121-at-yahoo.com@ffmpeg.org> 写道:
>>> 
>>> 
>>> On Dec 11, 2018, at 3:28 PM, Gyan <ffmpeg@gyani.pro> wrote:
>>> 
>>> 
>>>> On 12-12-2018 01:13 AM, Ronak wrote:
>>>> 
>>>> Looks like I found out why: https://github.com/FFmpeg/FFmpeg/blob/master/libavformat/hlsenc.c#L790. The hlsenc.c file overwrites whatever I pass in the command line...
>>> 
>>> That is a bug but there's still an error in your command. It should be,
>>> 
>>> 
>>>   -hls_ts_options movflags=+skip_sidx
>>> 
>>> This is because mp4 is a child muxer in this context. That hls option should be renamed.
>>> 
>>> Line 790 should be patched by adding + before frag_custom
>> 
>> That doesn't work.
>> 
>> ffmpeg -i input.mp4 -hls_ts_options movflags=+skip_sidx -codec copy -hls_time 0.97523809523809 -hls_segment_type fmp4 -hls_flags single_file -hls_playlist_type vod output.m3u8
>> ffmpeg version N-92677-gdd7d6034f1 Copyright (c) 2000-2018 the FFmpeg developers
>> built with gcc 4.4.6 (GCC) 20110731 (Red Hat 4.4.6-3)
>> configuration: --prefix=/home/ronakp/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/ronakp/ffmpeg_build/include --extra-ldflags=-L/home/ronakp/ffmpeg_build/lib --extra-libs=-lpthread --extra-libs=-lm --bindir=/home/ronakp/bin --enable-gpl --enable-libfdk_aac --enable-libmp3lame --enable-libopus --enable-nonfree
>> libavutil      56. 24.101 / 56. 24.101
>> libavcodec     58. 42.100 / 58. 42.100
>> libavformat    58. 24.100 / 58. 24.100
>> libavdevice    58.  6.101 / 58.  6.101
>> libavfilter     7. 46.101 /  7. 46.101
>> libswscale      5.  4.100 /  5.  4.100
>> libswresample   3.  4.100 /  3.  4.100
>> libpostproc    55.  4.100 / 55.  4.100
>> Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mp4':
>> Metadata:
>>   major_brand     : isom
>>   minor_version   : 1
>>   compatible_brands: isom
>>   creation_time   : 2013-11-14T18:23:26.000000Z
>> Duration: 02:39:09.39, start: 0.000000, bitrate: 31 kb/s
>>   Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 22050 Hz, mono, fltp, 30 kb/s (default)
>>   Metadata:
>>     creation_time   : 2013-11-14T18:23:26.000000Z
>>     handler_name    : GPAC ISO Audio Handler
>> [hls @ 0x23e1b00] Opening 'output.m4s' for writing
>> [hls @ 0x23e1b00] Some of provided format options in 'movflags=+skip_sidx' are not recognized
>> Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
>> Stream mapping:
>> Stream #0:0 -> #0:0 (copy)
>>   Last message repeated 1 times
>> 
>> Also, I think whatever options I set on the command line are going to be overwritten by line 790 in hlsenc.c anyway no?
> https://patchwork.ffmpeg.org/patch/11378/
> 
> Try this patch please :D

Thanks that works.

Let’s merge it!



>> 
>>> 
>>> Gyan
>>> 
>>> _______________________________________________
>>> 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
Ronak Patel Dec. 17, 2018, 1:07 p.m.
> On Dec 13, 2018, at 9:15 PM, Ronak Patel <ronak2121-at-yahoo.com@ffmpeg.org> wrote:
> 
> 
> 
>> On Dec 12, 2018, at 2:46 AM, Liu Steven <lq@chinaffmpeg.org> wrote:
>> 
>> 
>> 
>>>> 在 2018年12月12日,上午5:08,Ronak <ronak2121-at-yahoo.com@ffmpeg.org> 写道:
>>>> 
>>>> 
>>>> On Dec 11, 2018, at 3:28 PM, Gyan <ffmpeg@gyani.pro> wrote:
>>>> 
>>>> 
>>>>> On 12-12-2018 01:13 AM, Ronak wrote:
>>>>> 
>>>>> Looks like I found out why: https://github.com/FFmpeg/FFmpeg/blob/master/libavformat/hlsenc.c#L790. The hlsenc.c file overwrites whatever I pass in the command line...
>>>> 
>>>> That is a bug but there's still an error in your command. It should be,
>>>> 
>>>> 
>>>>  -hls_ts_options movflags=+skip_sidx
>>>> 
>>>> This is because mp4 is a child muxer in this context. That hls option should be renamed.
>>>> 
>>>> Line 790 should be patched by adding + before frag_custom
>>> 
>>> That doesn't work.
>>> 
>>> ffmpeg -i input.mp4 -hls_ts_options movflags=+skip_sidx -codec copy -hls_time 0.97523809523809 -hls_segment_type fmp4 -hls_flags single_file -hls_playlist_type vod output.m3u8
>>> ffmpeg version N-92677-gdd7d6034f1 Copyright (c) 2000-2018 the FFmpeg developers
>>> built with gcc 4.4.6 (GCC) 20110731 (Red Hat 4.4.6-3)
>>> configuration: --prefix=/home/ronakp/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/ronakp/ffmpeg_build/include --extra-ldflags=-L/home/ronakp/ffmpeg_build/lib --extra-libs=-lpthread --extra-libs=-lm --bindir=/home/ronakp/bin --enable-gpl --enable-libfdk_aac --enable-libmp3lame --enable-libopus --enable-nonfree
>>> libavutil      56. 24.101 / 56. 24.101
>>> libavcodec     58. 42.100 / 58. 42.100
>>> libavformat    58. 24.100 / 58. 24.100
>>> libavdevice    58.  6.101 / 58.  6.101
>>> libavfilter     7. 46.101 /  7. 46.101
>>> libswscale      5.  4.100 /  5.  4.100
>>> libswresample   3.  4.100 /  3.  4.100
>>> libpostproc    55.  4.100 / 55.  4.100
>>> Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mp4':
>>> Metadata:
>>>  major_brand     : isom
>>>  minor_version   : 1
>>>  compatible_brands: isom
>>>  creation_time   : 2013-11-14T18:23:26.000000Z
>>> Duration: 02:39:09.39, start: 0.000000, bitrate: 31 kb/s
>>>  Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 22050 Hz, mono, fltp, 30 kb/s (default)
>>>  Metadata:
>>>    creation_time   : 2013-11-14T18:23:26.000000Z
>>>    handler_name    : GPAC ISO Audio Handler
>>> [hls @ 0x23e1b00] Opening 'output.m4s' for writing
>>> [hls @ 0x23e1b00] Some of provided format options in 'movflags=+skip_sidx' are not recognized
>>> Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
>>> Stream mapping:
>>> Stream #0:0 -> #0:0 (copy)
>>>  Last message repeated 1 times
>>> 
>>> Also, I think whatever options I set on the command line are going to be overwritten by line 790 in hlsenc.c anyway no?
>> https://patchwork.ffmpeg.org/patch/11378/
>> 
>> Try this patch please :D
> 
> Thanks that works.
> 
> Let’s merge it!

Were you able to merge this patch?

> 
> 
>>> 
>>>> 
>>>> Gyan
>>>> 
>>>> _______________________________________________
>>>> 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
Steven Liu Dec. 17, 2018, 2:58 p.m.
> On Dec 17, 2018, at 21:07, Ronak Patel <ronak2121-at-yahoo.com@ffmpeg.org> wrote:
> 
>> 
>> On Dec 13, 2018, at 9:15 PM, Ronak Patel <ronak2121-at-yahoo.com@ffmpeg.org> wrote:
>> 
>> 
>> 
>>> On Dec 12, 2018, at 2:46 AM, Liu Steven <lq@chinaffmpeg.org> wrote:
>>> 
>>> 
>>> 
>>>>> 在 2018年12月12日,上午5:08,Ronak <ronak2121-at-yahoo.com@ffmpeg.org> 写道:
>>>>> 
>>>>> 
>>>>> On Dec 11, 2018, at 3:28 PM, Gyan <ffmpeg@gyani.pro> wrote:
>>>>> 
>>>>> 
>>>>>> On 12-12-2018 01:13 AM, Ronak wrote:
>>>>>> 
>>>>>> Looks like I found out why: https://github.com/FFmpeg/FFmpeg/blob/master/libavformat/hlsenc.c#L790. The hlsenc.c file overwrites whatever I pass in the command line...
>>>>> 
>>>>> That is a bug but there's still an error in your command. It should be,
>>>>> 
>>>>> 
>>>>> -hls_ts_options movflags=+skip_sidx
>>>>> 
>>>>> This is because mp4 is a child muxer in this context. That hls option should be renamed.
>>>>> 
>>>>> Line 790 should be patched by adding + before frag_custom
>>>> 
>>>> That doesn't work.
>>>> 
>>>> ffmpeg -i input.mp4 -hls_ts_options movflags=+skip_sidx -codec copy -hls_time 0.97523809523809 -hls_segment_type fmp4 -hls_flags single_file -hls_playlist_type vod output.m3u8
>>>> ffmpeg version N-92677-gdd7d6034f1 Copyright (c) 2000-2018 the FFmpeg developers
>>>> built with gcc 4.4.6 (GCC) 20110731 (Red Hat 4.4.6-3)
>>>> configuration: --prefix=/home/ronakp/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/ronakp/ffmpeg_build/include --extra-ldflags=-L/home/ronakp/ffmpeg_build/lib --extra-libs=-lpthread --extra-libs=-lm --bindir=/home/ronakp/bin --enable-gpl --enable-libfdk_aac --enable-libmp3lame --enable-libopus --enable-nonfree
>>>> libavutil      56. 24.101 / 56. 24.101
>>>> libavcodec     58. 42.100 / 58. 42.100
>>>> libavformat    58. 24.100 / 58. 24.100
>>>> libavdevice    58.  6.101 / 58.  6.101
>>>> libavfilter     7. 46.101 /  7. 46.101
>>>> libswscale      5.  4.100 /  5.  4.100
>>>> libswresample   3.  4.100 /  3.  4.100
>>>> libpostproc    55.  4.100 / 55.  4.100
>>>> Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mp4':
>>>> Metadata:
>>>> major_brand     : isom
>>>> minor_version   : 1
>>>> compatible_brands: isom
>>>> creation_time   : 2013-11-14T18:23:26.000000Z
>>>> Duration: 02:39:09.39, start: 0.000000, bitrate: 31 kb/s
>>>> Stream #0:0(und): Audio: aac (LC) (mp4a / 0x6134706D), 22050 Hz, mono, fltp, 30 kb/s (default)
>>>> Metadata:
>>>>   creation_time   : 2013-11-14T18:23:26.000000Z
>>>>   handler_name    : GPAC ISO Audio Handler
>>>> [hls @ 0x23e1b00] Opening 'output.m4s' for writing
>>>> [hls @ 0x23e1b00] Some of provided format options in 'movflags=+skip_sidx' are not recognized
>>>> Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
>>>> Stream mapping:
>>>> Stream #0:0 -> #0:0 (copy)
>>>> Last message repeated 1 times
>>>> 
>>>> Also, I think whatever options I set on the command line are going to be overwritten by line 790 in hlsenc.c anyway no?
>>> https://patchwork.ffmpeg.org/patch/11378/
>>> 
>>> Try this patch please :D
>> 
>> Thanks that works.
>> 
>> Let’s merge it!
> 
> Were you able to merge this patch?
No, i need more time to check that.
and look at this mail please,
i need check this patch first, [PATCH] Fix usage of temp_file flag in hls_flags option

> 
>> 
>> 
>>>> 
>>>>> 
>>>>> Gyan
>>>>> 
>>>>> _______________________________________________
>>>>> 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
> 
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Thanks
Steven

Patch hide | download patch | download mbox

diff --git a/doc/muxers.texi b/doc/muxers.texi
index f1cc6f5fee..ca10741900 100644
--- a/doc/muxers.texi
+++ b/doc/muxers.texi
@@ -1325,6 +1325,10 @@  more efficient), but with this option set, the muxer writes one moof/mdat
 pair for each track, making it easier to separate tracks.
 
 This option is implicitly set when writing ismv (Smooth Streaming) files.
+@item -movflags skip_sidx
+Skip writing of sidx atom. When bitrate overhead due to sidx atom is high,
+this option could be used for cases where sidx atom is not mandatory.
+When global_sidx flag is enabled, this option will be ignored. 
 @item -movflags faststart
 Run a second pass moving the index (moov atom) to the beginning of the file.
 This operation can take a while, and will not work in various situations such
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index 6dab5193b0..28cf8b719c 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -75,6 +75,7 @@  static const AVOption options[] = {
     { "frag_discont", "Signal that the next fragment is discontinuous from earlier ones", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MOV_FLAG_FRAG_DISCONT}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" },
     { "delay_moov", "Delay writing the initial moov until the first fragment is cut, or until the first fragment flush", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MOV_FLAG_DELAY_MOOV}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" },
     { "global_sidx", "Write a global sidx index at the start of the file", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MOV_FLAG_GLOBAL_SIDX}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" },
+    { "skip_sidx", "Skip writing of sidx atom", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MOV_FLAG_SKIP_SIDX}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" },
     { "write_colr", "Write colr atom (Experimental, may be renamed or changed, do not use from scripts)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MOV_FLAG_WRITE_COLR}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" },
     { "write_gama", "Write deprecated gama atom", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MOV_FLAG_WRITE_GAMA}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" },
     { "use_metadata_tags", "Use mdta atom for metadata.", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MOV_FLAG_USE_MDTA}, INT_MIN, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM, "movflags" },
@@ -4603,7 +4604,8 @@  static int mov_write_moof_tag(AVIOContext *pb, MOVMuxContext *mov, int tracks,
     mov_write_moof_tag_internal(avio_buf, mov, tracks, 0);
     moof_size = ffio_close_null_buf(avio_buf);
 
-    if (mov->flags & FF_MOV_FLAG_DASH && !(mov->flags & FF_MOV_FLAG_GLOBAL_SIDX))
+    if (mov->flags & FF_MOV_FLAG_DASH &&
+        !(mov->flags & (FF_MOV_FLAG_GLOBAL_SIDX | FF_MOV_FLAG_SKIP_SIDX)))
         mov_write_sidx_tags(pb, mov, tracks, moof_size + 8 + mdat_size);
 
     if (mov->write_prft > MOV_PRFT_NONE && mov->write_prft < MOV_PRFT_NB)
@@ -5422,7 +5424,8 @@  int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
              * the next fragment. This means the cts of the first sample must
              * be the same in all fragments, unless end_pts was updated by
              * the packet causing the fragment to be written. */
-            if ((mov->flags & FF_MOV_FLAG_DASH && !(mov->flags & FF_MOV_FLAG_GLOBAL_SIDX)) ||
+            if ((mov->flags & FF_MOV_FLAG_DASH &&
+                !(mov->flags & (FF_MOV_FLAG_GLOBAL_SIDX | FF_MOV_FLAG_SKIP_SIDX))) ||
                 mov->mode == MODE_ISM)
                 pkt->pts = pkt->dts + trk->end_pts - trk->cluster[trk->entry].dts;
         } else {
@@ -6067,6 +6070,11 @@  static int mov_init(AVFormatContext *s)
         s->flags &= ~AVFMT_FLAG_AUTO_BSF;
     }
 
+    if (mov->flags & FF_MOV_FLAG_GLOBAL_SIDX && mov->flags & FF_MOV_FLAG_SKIP_SIDX) {
+        av_log(s, AV_LOG_WARNING, "Global SIDX enabled; Ignoring skip_sidx option\n");
+        mov->flags &= ~FF_MOV_FLAG_SKIP_SIDX;
+    }
+
     if (mov->flags & FF_MOV_FLAG_FASTSTART) {
         mov->reserved_moov_size = -1;
     }
diff --git a/libavformat/movenc.h b/libavformat/movenc.h
index fe605d1ad2..68d6f23a5a 100644
--- a/libavformat/movenc.h
+++ b/libavformat/movenc.h
@@ -257,6 +257,7 @@  typedef struct MOVMuxContext {
 #define FF_MOV_FLAG_SKIP_TRAILER          (1 << 18)
 #define FF_MOV_FLAG_NEGATIVE_CTS_OFFSETS  (1 << 19)
 #define FF_MOV_FLAG_FRAG_EVERY_FRAME      (1 << 20)
+#define FF_MOV_FLAG_SKIP_SIDX             (1 << 21)
 
 int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt);