[FFmpeg-user] Audio Only Fragmented MP4 - SIDX

Ronak ronak2121 at yahoo.com
Fri Nov 16 01:46:41 EET 2018


I'm taking a look at moving.c and the mov_write_sidx_tags calls; I'm assuming this is the area of the code that is responsible for this. 

However, I'd have to have a way to detect the input streams are audio only; no video tracks. What would be the best way to do that?


> On Nov 12, 2018, at 12:11 PM, Ronak <ronak2121 at yahoo.com> wrote:
> 
> Hey All,
> 
> I noticed that ffmpeg always seems to generate a SIDX box when it's not really required for Audio Only content.
> 
> Example command:
> 
> ffmpeg -i atmosTest.mp4 -codec copy -hls_time 0.993 -hls_segment_type fmp4 -hls_flags single_file -hls_playlist_type vod atmosTestffmpeg.m3u8
> ffmpeg version N-92272-g0e9c01f Copyright (c) 2000-2018 the FFmpeg developers
>  built with Apple LLVM version 10.0.0 (clang-1000.11.45.2)
>  configuration: --prefix=/Users/ronakp/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/Users/ronakp/ffmpeg_build/include --extra-ldflags=-L/Users/ronakp/ffmpeg_build/lib --extra-libs=-lpthread --extra-libs=-lm --bindir=/Users/ronakp/bin --enable-libfdk_aac --enable-libmp3lame --enable-libopus --enable-nonfree
>  libavutil      56. 20.100 / 56. 20.100
>  libavcodec     58. 34.100 / 58. 34.100
>  libavformat    58. 19.102 / 58. 19.102
>  libavdevice    58.  4.106 / 58.  4.106
>  libavfilter     7. 38.100 /  7. 38.100
>  libswscale      5.  2.100 /  5.  2.100
>  libswresample   3.  2.100 /  3.  2.100
> Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'atmosTest.mp4':
>  Metadata:
>    major_brand     : mp42
>    minor_version   : 1
>    compatible_brands: mp42dby1isom
>    creation_time   : 2018-09-07T19:17:49.000000Z
>  Duration: 00:02:40.80, start: 0.000000, bitrate: 769 kb/s
>    Stream #0:0(und): Audio: eac3 (ec-3 / 0x332D6365), 48000 Hz, 5.1(side), fltp, 768 kb/s (default)
>    Metadata:
>      creation_time   : 2018-09-07T19:17:49.000000Z
>      handler_name    : sound handler
>    Side data:
>      audio service type: main
> [hls @ 0x7fbfc4825c00] Opening 'atmosTestffmpeg.m4s' for writing
> [mp4 @ 0x7fbfc4827600] track 0: codec frame size is not set
> Output #0, hls, to 'atmosTestffmpeg.m3u8':
>  Metadata:
>    major_brand     : mp42
>    minor_version   : 1
>    compatible_brands: mp42dby1isom
>    encoder         : Lavf58.19.102
>    Stream #0:0(und): Audio: eac3 (ec-3 / 0x332D6365), 48000 Hz, 5.1(side), fltp, 768 kb/s (default)
>    Metadata:
>      creation_time   : 2018-09-07T19:17:49.000000Z
>      handler_name    : sound handler
>    Side data:
>      audio service type: main
> Stream mapping:
>  Stream #0:0 -> #0:0 (copy)
> Press [q] to stop, [?] for help
> size=N/A time=00:02:40.76 bitrate=N/A speed= 397x    
> video:0kB audio:15075kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
> 
> When you look at the generated .m4s file, you will see ftyp, moov, followed by a collection of sidx, moof and mdat atoms. 
> 
> 
> However, when I run a similar command using Apple's Tooling:
> 
> 
> a45e60e46a79:Dolby ronakp$ mediafilesegmenter -a -r -s atmosTest.ec3
> Nov 12 2018 11:58:52.713: ISO fragmented mode, forcing segments to start with I-Frame
> Nov 12 2018 11:58:52.714: Processing file /Users/ronakp/Desktop/Dolby/atmosTest.ec3
> Nov 12 2018 11:58:52.743: Wrote 0 to 578 to main.mp4
> Nov 12 2018 11:58:52.748: Wrote 578 to 959266 to main.mp4
> Nov 12 2018 11:58:52.749: segment bitrate 768.18 kbits/sec is new max
> Nov 12 2018 11:58:52.756: Wrote 959266 to 1917954 to main.mp4
> Nov 12 2018 11:58:52.763: Wrote 1917954 to 2876642 to main.mp4
> Nov 12 2018 11:58:52.772: Wrote 2876642 to 3835330 to main.mp4
> Nov 12 2018 11:58:52.777: Wrote 3835330 to 4794018 to main.mp4
> Nov 12 2018 11:58:52.784: Wrote 4794018 to 5752706 to main.mp4
> Nov 12 2018 11:58:52.793: Wrote 5752706 to 6711394 to main.mp4
> Nov 12 2018 11:58:52.800: Wrote 6711394 to 7670082 to main.mp4
> Nov 12 2018 11:58:52.880: Wrote 7670082 to 8628770 to main.mp4
> Nov 12 2018 11:58:52.924: Wrote 8628770 to 9587458 to main.mp4
> Nov 12 2018 11:58:52.966: Wrote 9587458 to 10546146 to main.mp4
> Nov 12 2018 11:58:52.973: Wrote 10546146 to 11504834 to main.mp4
> Nov 12 2018 11:58:53.017: Wrote 11504834 to 12463522 to main.mp4
> Nov 12 2018 11:58:53.060: Wrote 12463522 to 13422210 to main.mp4
> Nov 12 2018 11:58:53.102: Wrote 13422210 to 14380898 to main.mp4
> Nov 12 2018 11:58:53.147: Wrote 14380898 to 15339586 to main.mp4
> Nov 12 2018 11:58:53.147: Wrote 15339586 to 15441066 to main.mp4
> Nov 12 2018 11:58:53.147: segment bitrate 768.24 kbits/sec is new max
> Nov 12 2018 11:58:53.147: Unknown video dynamic range value 0
> Nov 12 2018 11:58:53.147: average bit rate is 768.21 kbits/sec - max file bit rate is 768.24 kbits/sec
> 
> It generates a file without any SIDX atoms; only ftyp, moov & a collection of moof & mdat atoms.
> 
> Why does ffmpeg do this? How hard would it be to remove this behavior from ffmpeg?
> 
> Thanks,
> 
> Ronak
> 
> 
> 
> 



More information about the ffmpeg-user mailing list