Opened 3 years ago

Closed 3 years ago

#5318 closed defect (fixed)

ffmpeg segment format options are only applied to first segment

Reported by: jeroendnx Owned by: cus
Priority: normal Component: avformat
Version: unspecified Keywords: segment
Cc: cus@passwd.hu Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: yes

Description

Summary of the bug:

In the second example at
https://www.ffmpeg.org/ffmpeg-formats.html#Examples-6
there is segment output format option set, but this option is only applied to the first segment.

Tested ffmpeg 2.8 and 3.0

How to reproduce:

make segments:
ffmpeg -i /tmp/file.mp4 -f segment -segment_time 2 -segment_format_options movflags=faststart bout%03d.mp4

first segment:
qt-faststart bout000.mp4 bout000.mp4_2
ftyp 0 28
moov 28 1073
free 1101 8
mdat 1109 166746
last atom in file was not a moov atom
-> was already faststart, good

second segment:
qt-faststart bout001.mp4 bout000.mp4_2
ftyp 0 28
free 28 8
mdat 36 97857
moov 97893 1073
patching stco atom...
writing ftyp atom...
writing moov atom...
copying rest of file...
-> was not faststart yet, bad

Here is a log of ffmpeg only applying the option once:

ffmpeg -loglevel 100 -i big_buck_bunny_480p_surround-fix.avi -an -f segment -segment_time 2 -segment_format_options movflags=faststart out%03d.mp4 2>&1 | grep -e 'count' -e 'moov'

gives:
[mp4 @ 0x32e7200] Starting second pass: moving the moov atom to the beginning of the file
[segment @ 0x2502c00] segment:'out000.mp4' count:0 ended
[segment @ 0x2502c00] segment:'out001.mp4' count:1 ended
[segment @ 0x2502c00] segment:'out002.mp4' count:2 ended
[segment @ 0x2502c00] segment:'out003.mp4' count:3 ended
[segment @ 0x2502c00] segment:'out004.mp4' count:4 ended
[segment @ 0x2502c00] segment:'out005.mp4' count:5 ended
[segment @ 0x2502c00] segment:'out006.mp4' count:6 ended
[segment @ 0x2502c00] segment:'out007.mp4' count:7 ended

Attachments (1)

ffmpeg-20160309-164520.log (1.3 MB) - added by jeroendnx 3 years ago.
output of -report for ffmpeg git head version and -f lavfi -i testsrc

Download all attachments as: .zip

Change History (5)

comment:1 in reply to: ↑ description Changed 3 years ago by cehoyos

  • Component changed from undetermined to avformat
  • Keywords segment added

Replying to jeroendnx:

Tested ffmpeg 2.8 and 3.0

Please test current FFmpeg git head and please provide your simplified command line (-f lavfi -i testsrc) together with the complete, uncut console output to make this a valid ticket.
May be a duplicate of #2547.

Changed 3 years ago by jeroendnx

output of -report for ffmpeg git head version and -f lavfi -i testsrc

comment:2 Changed 3 years ago by jeroendnx

OK, tested it with git version and -f lavfi -i testsrc, see attachment

It has the same problem: only see "moving the moov atom to the beginning of the file" once in the output and qt-faststart out000.mp4 out.mp4 says it was already faststart and qt-faststart out001.mp4 out.mp4 gave no error

Last edited 3 years ago by jeroendnx (previous) (diff)

comment:3 Changed 3 years ago by cus

  • Analyzed by developer set
  • Owner set to cus
  • Reproduced by developer set
  • Status changed from new to open

comment:4 Changed 3 years ago by cus

  • Cc cus@passwd.hu added
  • Resolution set to fixed
  • Status changed from open to closed
Note: See TracTickets for help on using tickets.