Opened 10 years ago
Last modified 10 years ago
#5763 new defect
copy via HTTP with no transcode very slow for MOV vs. MP4
| Reported by: | Daniel Heidebrecht | Owned by: | |
|---|---|---|---|
| Priority: | normal | Component: | avformat |
| Version: | git-master | Keywords: | mov |
| Cc: | Blocked By: | ||
| Blocking: | Reproduced by developer: | no | |
| Analyzed by developer: | no |
Description
Summary of the bug: Copying a section from an MOV file with no transcoding via HTTP is very slow compared to the same operation on an MP4 file. In the example below - MOV elapsed time is 11 minutes, MP4 elapsed time is ~ 8 seconds.
How to reproduce: The original test file is an 85Mb MOV file, the MP4 comparison file was created by converting the MOV file to MP4:
ffmpeg -i test.mov -c copy test-copy.mp4
The MOV and MP4 files are both publicly available on S3:
https://s3.amazonaws.com/unclipvideo-test/test.mov
https://s3.amazonaws.com/unclipvideo-test/test-copy.mp4
MOV and MP4 example test output:
MOV test
time ./ffmpeg -ss 5 -i https://s3.amazonaws.com/unclipvideo-test/test.mov -t 15 -c copy test-s3.mov
ffmpeg version N-81504-g1fb8f6b-tessus Copyright (c) 2000-2016 the FFmpeg developers
built with Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn)
configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --as=yasm --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libass --enable-libbluray --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzmq --enable-version3 --disable-ffplay --disable-indev=qtkit --disable-indev=x11grab_xcb
libavutil 55. 28.100 / 55. 28.100
libavcodec 57. 51.100 / 57. 51.100
libavformat 57. 46.100 / 57. 46.100
libavdevice 57. 0.102 / 57. 0.102
libavfilter 6. 49.100 / 6. 49.100
libswscale 4. 1.100 / 4. 1.100
libswresample 2. 1.100 / 2. 1.100
libpostproc 54. 0.100 / 54. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'https://s3.amazonaws.com/unclipvideo-test/test.mov':
Metadata:
major_brand : qt
minor_version : 0
compatible_brands: qt
creation_time : 2016-07-31 22:04:54
com.apple.quicktime.location.ISO6709: +41.3207-071.9074-000.385/
com.apple.quicktime.make: Apple
com.apple.quicktime.model: iPhone 6s
com.apple.quicktime.software: 9.3.3
com.apple.quicktime.creationdate: 2016-07-31T18:04:54-0400
Duration: 00:00:40.80, start: 0.000000, bitrate: 17134 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080, 17042 kb/s, 29.98 fps, 29.97 tbr, 600 tbn, 1200 tbc (default)
Metadata:
creation_time : 2016-07-31 22:04:54
handler_name : Core Media Data Handler
encoder : H.264
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 82 kb/s (default)
Metadata:
creation_time : 2016-07-31 22:04:54
handler_name : Core Media Data Handler
Stream #0:2(und): Data: none (mebx / 0x7862656D), 0 kb/s (default)
Metadata:
creation_time : 2016-07-31 22:04:54
handler_name : Core Media Data Handler
Stream #0:3(und): Data: none (mebx / 0x7862656D), 0 kb/s (default)
Metadata:
creation_time : 2016-07-31 22:04:54
handler_name : Core Media Data Handler
[mov @ 0x7fe6f3002e00] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
Last message repeated 1 times
Output #0, mov, to 'test-s3.mov':
Metadata:
major_brand : qt
minor_version : 0
compatible_brands: qt
com.apple.quicktime.creationdate: 2016-07-31T18:04:54-0400
com.apple.quicktime.location.ISO6709: +41.3207-071.9074-000.385/
com.apple.quicktime.make: Apple
com.apple.quicktime.model: iPhone 6s
com.apple.quicktime.software: 9.3.3
encoder : Lavf57.46.100
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080, q=2-31, 17042 kb/s, 29.98 fps, 29.97 tbr, 19200 tbn, 600 tbc (default)
Metadata:
creation_time : 2016-07-31 22:04:54
handler_name : Core Media Data Handler
encoder : H.264
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, 82 kb/s (default)
Metadata:
creation_time : 2016-07-31 22:04:54
handler_name : Core Media Data Handler
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame= 480 fps=0.7 q=-1.0 Lsize= 33291kB time=00:00:15.01 bitrate=18162.3kbits/s speed=0.0227x
video:33113kB audio:163kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.044288%
real 11m5.040s
user 0m3.638s
sys 0m1.768s
MP4 test:
time ./ffmpeg -ss 5 -i https://s3.amazonaws.com/unclipvideo-test/test-copy.mp4 -t 15 -c copy test-s3.mp4
ffmpeg version N-81504-g1fb8f6b-tessus Copyright (c) 2000-2016 the FFmpeg developers
built with Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn)
configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --as=yasm --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libass --enable-libbluray --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzmq --enable-version3 --disable-ffplay --disable-indev=qtkit --disable-indev=x11grab_xcb
libavutil 55. 28.100 / 55. 28.100
libavcodec 57. 51.100 / 57. 51.100
libavformat 57. 46.100 / 57. 46.100
libavdevice 57. 0.102 / 57. 0.102
libavfilter 6. 49.100 / 6. 49.100
libswscale 4. 1.100 / 4. 1.100
libswresample 2. 1.100 / 2. 1.100
libpostproc 54. 0.100 / 54. 0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'https://s3.amazonaws.com/unclipvideo-test/test-copy.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.25.100
Duration: 00:00:40.87, start: 0.000000, bitrate: 17102 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080, 17042 kb/s, 29.98 fps, 29.97 tbr, 19200 tbn, 38400 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 82 kb/s (default)
Metadata:
handler_name : SoundHandler
[mp4 @ 0x7fcc5901ac00] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
Last message repeated 1 times
Output #0, mp4, to 'test-s3.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.46.100
Stream #0:0(und): Video: h264 (High) ([33][0][0][0] / 0x0021), yuv420p(tv, bt709), 1920x1080, q=2-31, 17042 kb/s, 29.98 fps, 29.97 tbr, 19200 tbn, 19200 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) ([64][0][0][0] / 0x0040), 44100 Hz, mono, 82 kb/s (default)
Metadata:
handler_name : SoundHandler
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame= 480 fps=104 q=-1.0 Lsize= 33291kB time=00:00:15.01 bitrate=18162.2kbits/s speed=3.25x
video:33113kB audio:163kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.044021%
real 0m7.502s
user 0m0.290s
sys 0m0.203s
ffmpeg version:
ffmpeg version N-81504-g1fb8f6b-tessus Copyright (c) 2000-2016 the FFmpeg developers built with Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn)
Change History (3)
comment:1 by , 10 years ago
| Version: | unspecified → git-master |
|---|
comment:2 by , 10 years ago
| Component: | ffmpeg → avformat |
|---|---|
| Keywords: | mov added |



The fact that FFmpeg seeks wildly in the original mov file (but not in a file remuxed with FFmpeg) leading to many slow reconnections is reproducible with the following command line:
$ ffmpeg -loglevel debug -i test.mov -c copy -f null - ffmpeg version N-81379-gf866f22 Copyright (c) 2000-2016 the FFmpeg developers built with gcc 4.7 (SUSE Linux) configuration: --enable-gpl --enable-gnutls libavutil 55. 28.100 / 55. 28.100 libavcodec 57. 53.100 / 57. 53.100 libavformat 57. 47.101 / 57. 47.101 libavdevice 57. 0.102 / 57. 0.102 libavfilter 6. 52.100 / 6. 52.100 libswscale 4. 1.100 / 4. 1.100 libswresample 2. 1.100 / 2. 1.100 libpostproc 54. 0.100 / 54. 0.100 Splitting the commandline. Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'. Reading option '-i' ... matched as input file with argument 'test.mov'. Reading option '-c' ... matched as option 'c' (codec name) with argument 'copy'. Reading option '-f' ... matched as option 'f' (force format) with argument 'null'. Reading option '-' ... matched as output file. Finished splitting the commandline. Parsing a group of options: global . Applying option loglevel (set logging level) with argument debug. Successfully parsed a group of options. Parsing a group of options: input file test.mov. Successfully parsed a group of options. Opening an input file: test.mov. [file @ 0x28a4e80] Setting default whitelist 'file,crypto' [mov,mp4,m4a,3gp,3g2,mj2 @ 0x28a4640] Format mov,mp4,m4a,3gp,3g2,mj2 probed with size=2048 and score=100 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x28a4640] ISO: File Type Major Brand: qt [mov,mp4,m4a,3gp,3g2,mj2 @ 0x28a4640] Unknown dref type 0x0873696c61 size 12 Last message repeated 3 times [mov,mp4,m4a,3gp,3g2,mj2 @ 0x28a4640] rfps: 29.833333 0.019205 Last message repeated 1 times [mov,mp4,m4a,3gp,3g2,mj2 @ 0x28a4640] rfps: 29.916667 0.003699 Last message repeated 1 times [mov,mp4,m4a,3gp,3g2,mj2 @ 0x28a4640] rfps: 30.000000 0.000558 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x28a4640] rfps: 60.000000 0.002233 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x28a4640] rfps: 120.000000 0.008934 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x28a4640] rfps: 29.970030 0.000264 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x28a4640] rfps: 59.940060 0.001055 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x28a4640] Before avformat_find_stream_info() pos: 87380080 bytes read:53138 seeks:1 nb_streams:4 [h264 @ 0x28a66a0] nal_unit_type: 7, nal_ref_idc: 1 [h264 @ 0x28a66a0] nal_unit_type: 8, nal_ref_idc: 1 [h264 @ 0x28a66a0] nal_unit_type: 6, nal_ref_idc: 0 [h264 @ 0x28a66a0] nal_unit_type: 5, nal_ref_idc: 1 [h264 @ 0x28a66a0] Reinit context to 1920x1088, pix_fmt: yuv420p [mov,mp4,m4a,3gp,3g2,mj2 @ 0x28a4640] All info found [mov,mp4,m4a,3gp,3g2,mj2 @ 0x28a4640] After avformat_find_stream_info() pos: 206381 bytes read:259483 seeks:2 frames:45 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test.mov': Metadata: major_brand : qt minor_version : 0 compatible_brands: qt creation_time : 2016-07-31 22:04:54 com.apple.quicktime.location.ISO6709: +41.3207-071.9074-000.385/ com.apple.quicktime.make: Apple com.apple.quicktime.model: iPhone 6s com.apple.quicktime.software: 9.3.3 com.apple.quicktime.creationdate: 2016-07-31T18:04:54-0400 Duration: 00:00:40.80, start: 0.000000, bitrate: 17134 kb/s Stream #0:0(und), 1, 1/600: Video: h264 (High), 1 reference frame (avc1 / 0x31637661), yuv420p(tv, bt709, left), 1920x1080 (1920x1088), 0/1, 17042 kb/s, 29.98 fps, 29.97 tbr, 600 tbn, 1200 tbc (default) Metadata: creation_time : 2016-07-31 22:04:54 handler_name : Core Media Data Handler encoder : H.264 Stream #0:1(und), 44, 1/44100: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 82 kb/s (default) Metadata: creation_time : 2016-07-31 22:04:54 handler_name : Core Media Data Handler Stream #0:2(und), 0, 1/600: Data: none (mebx / 0x7862656D), 0/1, 0 kb/s (default) Metadata: creation_time : 2016-07-31 22:04:54 handler_name : Core Media Data Handler Stream #0:3(und), 0, 1/600: Data: none (mebx / 0x7862656D), 0/1, 0 kb/s (default) Metadata: creation_time : 2016-07-31 22:04:54 handler_name : Core Media Data Handler Successfully opened the file. Parsing a group of options: output file -. Applying option c (codec name) with argument copy. Applying option f (force format) with argument null. Successfully parsed a group of options. Opening an output file: -. Successfully opened the file. [null @ 0x28f2a60] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead. Last message repeated 1 times Output #0, null, to 'pipe:': Metadata: major_brand : qt minor_version : 0 compatible_brands: qt com.apple.quicktime.creationdate: 2016-07-31T18:04:54-0400 com.apple.quicktime.location.ISO6709: +41.3207-071.9074-000.385/ com.apple.quicktime.make: Apple com.apple.quicktime.model: iPhone 6s com.apple.quicktime.software: 9.3.3 encoder : Lavf57.47.101 Stream #0:0(und), 0, 1/600: Video: h264 (High), 1 reference frame (avc1 / 0x31637661), yuv420p(tv, bt709, left), 1920x1080 (0x0), 0/1, q=2-31, 17042 kb/s, 29.98 fps, 29.97 tbr, 600 tbn, 600 tbc (default) Metadata: creation_time : 2016-07-31 22:04:54 handler_name : Core Media Data Handler encoder : H.264 Stream #0:1(und), 0, 1/44100: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, 82 kb/s (default) Metadata: creation_time : 2016-07-31 22:04:54 handler_name : Core Media Data Handler Stream mapping: Stream #0:0 -> #0:0 (copy) Stream #0:1 -> #0:1 (copy) Press [q] to stop, [?] for help cur_dts is invalid (this is harmless if it occurs once at the start per stream) Last message repeated 45 times No more output streams to write to, finishing. frame= 1223 fps=0.0 q=-1.0 Lsize=N/A time=00:00:40.86 bitrate=N/A speed=1.43e+03x video:84872kB audio:413kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown Input file #0 (test.mov): Input stream #0:0 (video): 1223 packets read (86909375 bytes); Input stream #0:1 (audio): 1760 packets read (423378 bytes); Input stream #0:2 (data): 0 packets read (0 bytes); Input stream #0:3 (data): 0 packets read (0 bytes); Total: 2983 packets (87332753 bytes) demuxed Output file #0 (pipe:): Output stream #0:0 (video): 1223 packets muxed (86909375 bytes); Output stream #0:1 (audio): 1760 packets muxed (423378 bytes); Total: 2983 packets (87332753 bytes) muxed 0 frames successfully decoded, 0 decoding errors [AVIOContext @ 0x28a5160] Statistics: 127025736 bytes read, 2419 seeksI don't know if there is a bug that can be fixed in FFmpeg.