Answers.Body: <p>Looks like MP4 won't skip the <code>edts</code> boxes when creating MP4s. You should transcode to MPEG-TS and feed that into mediafilesegmenter</p>
  
  <pre><code>ffmpeg -i in.mp4 -&lt;transcoding options&gt; -vbsf h264_mp4toannexb out.ts
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-07-01T00:53:34.047Z
Answers.Text: I tried with no options (just ffmpeg -i in.mp4 -bsf:v h264_mp4toannexb out.ts) but running mediafilesegmenter on out.ts only produced audio. I had to add "-c:v copy -c:a copy" to the ffmpeg command to make it work.
Answers.UserDisplayName: Peter Tseng
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-06-30T05:33:50.620Z
Answers.LastActivityDate: 2016-06-30T05:33:50.620Z
Answers.UserDisplayName: Gyan
Answers.Body: <p>I prefer Mulvya's approach, but another method that "fixes" the problem is to demux and mux the streams:</p>
  
  <pre><code>ffmpeg -i in.mp4 -c:v copy -an video.mkv
  ffmpeg -i in.mp4 -vn -c:a copy audio.mkv
  ffmpeg -i video.mkv -i audio.mkv -c:v copy -c:a copy in2.mp4
  mediafilesegmenter -I -t 9 -s in2.mp4
  </code></pre>
  
  <p>I can't tell you why it works though.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-07-01T00:58:20.027Z
Answers.LastActivityDate: 2016-07-01T00:58:20.027Z
Answers.UserDisplayName: Peter Tseng
Body: <p>I'm trying to use mediafilesegmenter on a video I transcoded with ffmpeg to package it for HLS. However, it complains about "edit lists" and refuses to do anything. Does anyone know how to either remove edit lists or to get mediafilesegmenter to work with them?</p>
  
  <pre><code>$ mediafilesegmenter -I -f 180 -t 9 -s bbb_180p_30fps_264k.mp4
  Jun 29 2016 17:12:33.676: Using floating point is not backward compatible to iOS 4.1 or earlier devices
  Jun 29 2016 17:12:33.677: Single file output is not backward compatible to earlier than iOS 5.0
  Jun 29 2016 17:12:33.677: Processing file /Users/aspera/git/dash-demo/video-transcoding/bbb-transcoded-hls/bbb_180p_30fps_264k.mp4
  Jun 29 2016 17:12:33.689: track 1 of /Users/aspera/git/dash-demo/video-transcoding/bbb-transcoded-hls/bbb_180p_30fps_264k.mp4 contains edit lists; these tracks cannot be used for segmentation
  Jun 29 2016 17:12:33.689: no tracks found!
  Jun 29 2016 17:12:33.689: average bit rate is  0.00 bits/sec - max file bit rate is  0.00 bits/sec
  </code></pre>
  
  <p>The input video:</p>
  
  <pre><code>$ ffprobe bbb_180p_30fps_264k.mp4 
  ffprobe version 3.0.2 Copyright (c) 2007-2016 the FFmpeg developers
    built with Apple LLVM version 7.3.0 (clang-703.0.31)
    configuration: --prefix=/usr/local/Cellar/ffmpeg/3.0.2 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-opencl --enable-libx264 --enable-libmp3lame --enable-libxvid --enable-libfdk-aac --enable-nonfree --enable-vda
    libavutil      55. 17.103 / 55. 17.103
    libavcodec     57. 24.102 / 57. 24.102
    libavformat    57. 25.100 / 57. 25.100
    libavdevice    57.  0.101 / 57.  0.101
    libavfilter     6. 31.100 /  6. 31.100
    libavresample   3.  0.  0 /  3.  0.  0
    libswscale      4.  0.100 /  4.  0.100
    libswresample   2.  0.101 /  2.  0.101
    libpostproc    54.  0.100 / 54.  0.100
  Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'bbb_180p_30fps_264k.mp4':
    Metadata:
      major_brand     : isom
      minor_version   : 512
      compatible_brands: isomiso2avc1mp41
      title           : Big Buck Bunny, Sunflower version
      artist          : Blender Foundation 2008, Janus Bager Kristensen 2013
      composer        : Sacha Goedegebure
      encoder         : Lavf57.25.100
      comment         : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
      genre           : Animation
    Duration: 00:10:34.53, start: 0.021333, bitrate: 184 kb/s
      Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 320x180 [SAR 1:1 DAR 16:9], 113 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
      Metadata:
        handler_name    : VideoHandler
      Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 64 kb/s (default)
      Metadata:
        handler_name    : SoundHandler
  </code></pre>
  
  <p>EDIT:
  I've discovered that ffmpeg seems to add edit lists when transcoding.</p>
  
  <p>Original file:</p>
  
  <pre><code>$ MP4Box -info originals/bbb_sunflower_2160p_60fps_normal.mp4 
  * Movie Info *
      Timescale 600 - 3 tracks
      Computed Duration 00:10:34.533 - Indicated Duration 00:10:34.533
      Fragmented File: no
      File suitable for progressive download (moov before mdat)
      File Brand isom - version 1
      Created: GMT Tue Dec 17 16:40:26 2013
      Modified: GMT Tue Dec 17 16:40:26 2013
  
  File has root IOD (9 bytes)
  Scene PL 0xff - Graphics PL 0xff - OD PL 0xff
  Visual PL: ISO Reserved Profile (0x15)
  Audio PL: Not part of MPEG-4 audio profiles (0xfe)
  No streams included in root OD
  
  iTunes Info:
      Name: Big Buck Bunny, Sunflower version
      Artist: Blender Foundation 2008, Janus Bager Kristensen 2013
      Comment: Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
      Composer: Jan Morgenstern
      Writer: Sacha Goedegebure
      Genre: Animation
  1 UDTA types: meta (1) 
  
  Track # 1 Info - TrackID 1 - TimeScale 60000
  Media Duration 00:10:34.533 - Indicated Duration 00:10:34.533
  Media Info: Language "und (und)" - Type "vide:avc1" - 38072 samples
  Visual Track layout: x=0 y=0 width=3840 height=2160
  MPEG-4 Config: Visual Stream - ObjectTypeIndication 0x21
  AVC/H264 Video - Visual Size 3840 x 2160
      AVC Info: 1 SPS - 1 PPS - Profile High @ Level 5.1
      NAL Unit length bits: 32
      Pixel Aspect Ratio 1:1 - Indicated track size 3840 x 2160
      SPS#1 hash: 73C3B5E51841EEDF280132A1F7C72DD97D9FDE86
      PPS#1 hash: EB72205FBA0E2A677BE65E145507E2E05750EB4F
  Self-synchronized
      RFC6381 Codec Parameters: avc1.640033
      Average GOP length: 184 samples
  
  Track # 2 Info - TrackID 2 - TimeScale 48000
  Media Duration 00:10:34.200 - Indicated Duration 00:10:34.200
  Media Info: Language "und (und)" - Type "soun:mp4a" - 26425 samples
  MPEG-4 Config: Audio Stream - ObjectTypeIndication 0x6b
  MPEG-1 Audio - 2 Channel(s) - SampleRate 48000 - Layer 3
  Synchronized on stream 1
      RFC6381 Codec Parameters: mp4a.6b
      All samples are sync
  
  Track # 3 Info - TrackID 3 - TimeScale 48000
  Media Duration 00:10:34.144 - Indicated Duration 00:10:34.144
  Media Info: Language "und (und)" - Type "soun:ac-3" - 19817 samples
      AC-3 stream - Sample Rate 48000 - 5.1 channel(s) - bitrate 32000
      RFC6381 Codec Parameters: ac-3
      All samples are sync
  </code></pre>
  
  <p>After FFMPEG:</p>
  
  <pre><code>$ MP4Box -info bbb_180p_30fps_264k.mp4 
  * Movie Info *
      Timescale 1000 - 2 tracks
      Computed Duration 00:10:34.600 - Indicated Duration 00:10:34.534
      Fragmented File: no
      File Brand isom - version 512
      Created: UNKNOWN DATE   Modified: UNKNOWN DATE
  File has no MPEG4 IOD/OD
  
  iTunes Info:
      Name: Big Buck Bunny, Sunflower version
      Artist: Blender Foundation 2008, Janus Bager Kristensen 2013
      Comment: Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
      Writer: Sacha Goedegebure
      Genre: Animation
      Encoder Software: Lavf57.25.100
  1 UDTA types: meta (1) 
  
  Track # 1 Info - TrackID 1 - TimeScale 15360
  Media Duration 00:10:34.533 - Indicated Duration 00:10:34.533
  Track has 2 edit lists: track duration is 00:10:34.600
  Media Info: Language "und (und)" - Type "vide:avc1" - 19036 samples
  Visual Track layout: x=0 y=0 width=320 height=180
  MPEG-4 Config: Visual Stream - ObjectTypeIndication 0x21
  AVC/H264 Video - Visual Size 320 x 180
      AVC Info: 1 SPS - 1 PPS - Profile Baseline @ Level 3
      NAL Unit length bits: 32
      Pixel Aspect Ratio 1:1 - Indicated track size 320 x 180
      SPS#1 hash: 4FD0A6F8F73D905B5A9973F02BF9E2D401820F71
      PPS#1 hash: E79F98332B320CB0B190539E0D4A262181656B90
  Self-synchronized
      RFC6381 Codec Parameters: avc1.42c01e
      Average GOP length: 90 samples
  
  Track # 2 Info - TrackID 2 - TimeScale 48000
  Media Duration 00:10:34.221 - Indicated Duration 00:10:34.221
  Track has 1 edit lists: track duration is 00:10:34.200
  Media Info: Language "und (und)" - Type "soun:mp4a" - 29730 samples
  MPEG-4 Config: Audio Stream - ObjectTypeIndication 0x40
  MPEG-4 Audio AAC LC - 2 Channel(s) - SampleRate 48000
  Synchronized on stream 1
      RFC6381 Codec Parameters: mp4a.40.2
  Alternate Group ID 1
      All samples are sync
  </code></pre>
  
Tags: <video><ffmpeg><encoding>
Title: Using mediafilesegmenter on a video with edit lists
UserDisplayName: Peter Tseng
ThreadText: # Using mediafilesegmenter on a video with edit lists
  
  (Asked by: username_0 on 2016-06-30)
  
  I'm trying to use mediafilesegmenter on a video I transcoded with ffmpeg to package it for HLS. However, it complains about "edit lists" and refuses to do anything. Does anyone know how to either remove edit lists or to get mediafilesegmenter to work with them?
  
  ```
  $ mediafilesegmenter -I -f 180 -t 9 -s bbb_180p_30fps_264k.mp4
  Jun 29 2016 17:12:33.676: Using floating point is not backward compatible to iOS 4.1 or earlier devices
  Jun 29 2016 17:12:33.677: Single file output is not backward compatible to earlier than iOS 5.0
  Jun 29 2016 17:12:33.677: Processing file /Users/aspera/git/dash-demo/video-transcoding/bbb-transcoded-hls/bbb_180p_30fps_264k.mp4
  Jun 29 2016 17:12:33.689: track 1 of /Users/aspera/git/dash-demo/video-transcoding/bbb-transcoded-hls/bbb_180p_30fps_264k.mp4 contains edit lists; these tracks cannot be used for segmentation
  Jun 29 2016 17:12:33.689: no tracks found!
  Jun 29 2016 17:12:33.689: average bit rate is  0.00 bits/sec - max file bit rate is  0.00 bits/sec
  
  ```
  
  The input video:
  
  ```
  $ ffprobe bbb_180p_30fps_264k.mp4 
  ffprobe version 3.0.2 Copyright (c) 2007-2016 the FFmpeg developers
    built with Apple LLVM version 7.3.0 (clang-703.0.31)
    configuration: --prefix=/usr/local/Cellar/ffmpeg/3.0.2 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-opencl --enable-libx264 --enable-libmp3lame --enable-libxvid --enable-libfdk-aac --enable-nonfree --enable-vda
    libavutil      55. 17.103 / 55. 17.103
    libavcodec     57. 24.102 / 57. 24.102
    libavformat    57. 25.100 / 57. 25.100
    libavdevice    57.  0.101 / 57.  0.101
    libavfilter     6. 31.100 /  6. 31.100
    libavresample   3.  0.  0 /  3.  0.  0
    libswscale      4.  0.100 /  4.  0.100
    libswresample   2.  0.101 /  2.  0.101
    libpostproc    54.  0.100 / 54.  0.100
  Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'bbb_180p_30fps_264k.mp4':
    Metadata:
      major_brand     : isom
      minor_version   : 512
      compatible_brands: isomiso2avc1mp41
      title           : Big Buck Bunny, Sunflower version
      artist          : Blender Foundation 2008, Janus Bager Kristensen 2013
      composer        : Sacha Goedegebure
      encoder         : Lavf57.25.100
      comment         : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
      genre           : Animation
    Duration: 00:10:34.53, start: 0.021333, bitrate: 184 kb/s
      Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 320x180 [SAR 1:1 DAR 16:9], 113 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
      Metadata:
        handler_name    : VideoHandler
      Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 64 kb/s (default)
      Metadata:
        handler_name    : SoundHandler
  
  ```
  
  EDIT:
  I've discovered that ffmpeg seems to add edit lists when transcoding.
  
  Original file:
  
  ```
  $ MP4Box -info originals/bbb_sunflower_2160p_60fps_normal.mp4 
  * Movie Info *
      Timescale 600 - 3 tracks
      Computed Duration 00:10:34.533 - Indicated Duration 00:10:34.533
      Fragmented File: no
      File suitable for progressive download (moov before mdat)
      File Brand isom - version 1
      Created: GMT Tue Dec 17 16:40:26 2013
      Modified: GMT Tue Dec 17 16:40:26 2013
  
  File has root IOD (9 bytes)
  Scene PL 0xff - Graphics PL 0xff - OD PL 0xff
  Visual PL: ISO Reserved Profile (0x15)
  Audio PL: Not part of MPEG-4 audio profiles (0xfe)
  No streams included in root OD
  
  iTunes Info:
      Name: Big Buck Bunny, Sunflower version
      Artist: Blender Foundation 2008, Janus Bager Kristensen 2013
      Comment: Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
      Composer: Jan Morgenstern
      Writer: Sacha Goedegebure
      Genre: Animation
  1 UDTA types: meta (1) 
  
  Track # 1 Info - TrackID 1 - TimeScale 60000
  Media Duration 00:10:34.533 - Indicated Duration 00:10:34.533
  Media Info: Language "und (und)" - Type "vide:avc1" - 38072 samples
  Visual Track layout: x=0 y=0 width=3840 height=2160
  MPEG-4 Config: Visual Stream - ObjectTypeIndication 0x21
  AVC/H264 Video - Visual Size 3840 x 2160
      AVC Info: 1 SPS - 1 PPS - Profile High @ Level 5.1
      NAL Unit length bits: 32
      Pixel Aspect Ratio 1:1 - Indicated track size 3840 x 2160
      SPS#1 hash: 73C3B5E51841EEDF280132A1F7C72DD97D9FDE86
      PPS#1 hash: EB72205FBA0E2A677BE65E145507E2E05750EB4F
  Self-synchronized
      RFC6381 Codec Parameters: avc1.640033
      Average GOP length: 184 samples
  
  Track # 2 Info - TrackID 2 - TimeScale 48000
  Media Duration 00:10:34.200 - Indicated Duration 00:10:34.200
  Media Info: Language "und (und)" - Type "soun:mp4a" - 26425 samples
  MPEG-4 Config: Audio Stream - ObjectTypeIndication 0x6b
  MPEG-1 Audio - 2 Channel(s) - SampleRate 48000 - Layer 3
  Synchronized on stream 1
      RFC6381 Codec Parameters: mp4a.6b
      All samples are sync
  
  Track # 3 Info - TrackID 3 - TimeScale 48000
  Media Duration 00:10:34.144 - Indicated Duration 00:10:34.144
  Media Info: Language "und (und)" - Type "soun:ac-3" - 19817 samples
      AC-3 stream - Sample Rate 48000 - 5.1 channel(s) - bitrate 32000
      RFC6381 Codec Parameters: ac-3
      All samples are sync
  
  ```
  
  After FFMPEG:
  
  ```
  $ MP4Box -info bbb_180p_30fps_264k.mp4 
  * Movie Info *
      Timescale 1000 - 2 tracks
      Computed Duration 00:10:34.600 - Indicated Duration 00:10:34.534
      Fragmented File: no
      File Brand isom - version 512
      Created: UNKNOWN DATE   Modified: UNKNOWN DATE
  File has no MPEG4 IOD/OD
  
  iTunes Info:
      Name: Big Buck Bunny, Sunflower version
      Artist: Blender Foundation 2008, Janus Bager Kristensen 2013
      Comment: Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net
      Writer: Sacha Goedegebure
      Genre: Animation
      Encoder Software: Lavf57.25.100
  1 UDTA types: meta (1) 
  
  Track # 1 Info - TrackID 1 - TimeScale 15360
  Media Duration 00:10:34.533 - Indicated Duration 00:10:34.533
  Track has 2 edit lists: track duration is 00:10:34.600
  Media Info: Language "und (und)" - Type "vide:avc1" - 19036 samples
  Visual Track layout: x=0 y=0 width=320 height=180
  MPEG-4 Config: Visual Stream - ObjectTypeIndication 0x21
  AVC/H264 Video - Visual Size 320 x 180
      AVC Info: 1 SPS - 1 PPS - Profile Baseline @ Level 3
      NAL Unit length bits: 32
      Pixel Aspect Ratio 1:1 - Indicated track size 320 x 180
      SPS#1 hash: 4FD0A6F8F73D905B5A9973F02BF9E2D401820F71
      PPS#1 hash: E79F98332B320CB0B190539E0D4A262181656B90
  Self-synchronized
      RFC6381 Codec Parameters: avc1.42c01e
      Average GOP length: 90 samples
  
  Track # 2 Info - TrackID 2 - TimeScale 48000
  Media Duration 00:10:34.221 - Indicated Duration 00:10:34.221
  Track has 1 edit lists: track duration is 00:10:34.200
  Media Info: Language "und (und)" - Type "soun:mp4a" - 29730 samples
  MPEG-4 Config: Audio Stream - ObjectTypeIndication 0x40
  MPEG-4 Audio AAC LC - 2 Channel(s) - SampleRate 48000
  Synchronized on stream 1
      RFC6381 Codec Parameters: mp4a.40.2
  Alternate Group ID 1
      All samples are sync
  
  ```
  
  **Tags:** video, ffmpeg, encoding
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2016-06-30. Score: 1 | Accepted answer
  
  Looks like MP4 won't skip the `edts` boxes when creating MP4s. You should transcode to MPEG-TS and feed that into mediafilesegmenter
  
  ```
  ffmpeg -i in.mp4 -<transcoding options> -vbsf h264_mp4toannexb out.ts
  
  ```
  
  > **Comments:**
  > **username_0**: I tried with no options (just ffmpeg -i in.mp4 -bsf:v h264_mp4toannexb out.ts) but running mediafilesegmenter on out.ts only produced audio. I had to add "-c:v copy -c:a copy" to the ffmpeg command to make it work.  
  
  ---
  
  ### Answer by username_0 on 2016-07-01. Score: 0
  
  I prefer Mulvya's approach, but another method that "fixes" the problem is to demux and mux the streams:
  
  ```
  ffmpeg -i in.mp4 -c:v copy -an video.mkv
  ffmpeg -i in.mp4 -vn -c:a copy audio.mkv
  ffmpeg -i video.mkv -i audio.mkv -c:v copy -c:a copy in2.mp4
  mediafilesegmenter -I -t 9 -s in2.mp4
  
  ```
  
  I can't tell you why it works though.
  
  
  ---
  
  