Opened 6 years ago

Closed 5 years ago

#7373 closed defect (wontfix)

FFmpeg does a lot of strange seeking while transcoding

Reported by: ronag Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: mov
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

when decoding certain files ffmpeg does a lot of strange seeking which in the case of the file living on an HTTP endpoint can end up DDoS our http server.

Here is the file:
https://drive.google.com/open?id=1ruuc6eXSApvlnvYCExtTs4gaXM9PQOoC

I've grepped the range requests that ffmpeg performs. You can see it is jumping alot back and forth.

ffmpeg -loglevel trace -i http://localhost:8888/file/MKPuEVBF_PvV0T -f nut - 2>&1 >/dev/null | grep bytes=
Range: bytes=0-
Range: bytes=39850850-
Range: bytes=36-
Range: bytes=11742-
Range: bytes=12005-
Range: bytes=12275-
Range: bytes=439676-
Range: bytes=12817-
Range: bytes=483657-
Range: bytes=13107-
Range: bytes=524035-
Range: bytes=13651-
Range: bytes=575397-
Range: bytes=13918-
Range: bytes=626706-
Range: bytes=14442-
Range: bytes=676417-
Range: bytes=14711-
Range: bytes=733895-
Range: bytes=14992-
Range: bytes=794126-
Range: bytes=15534-
Range: bytes=853791-
Range: bytes=15797-
Range: bytes=913017-
Range: bytes=16330-
Range: bytes=972869-
Range: bytes=16597-
Range: bytes=1033164-
Range: bytes=17141-
Range: bytes=1097852-
Range: bytes=17408-
Range: bytes=1159532-
Range: bytes=17934-
Range: bytes=1218093-
Range: bytes=18197-
Range: bytes=1276972-
Range: bytes=18458-
Range: bytes=1339391-
Range: bytes=18975-
Range: bytes=1402163-
Range: bytes=19241-
Range: bytes=1464991-
Range: bytes=19764-
Range: bytes=1528430-
Range: bytes=20034-
Range: bytes=1589897-
Range: bytes=20573-
Range: bytes=1649879-
Range: bytes=20874-
Range: bytes=1708516-
Range: bytes=21151-
Range: bytes=1768333-
Range: bytes=21697-
Range: bytes=1826232-
Range: bytes=21973-
Range: bytes=1884122-
Range: bytes=22518-
Range: bytes=1949070-
Range: bytes=22793-
Range: bytes=2019703-
Range: bytes=1091441-
Range: bytes=2142988-
Range: bytes=1091707-
Range: bytes=2203840-
Range: bytes=1092248-
Range: bytes=2263186-
Range: bytes=1092525-
Range: bytes=2321273-
Range: bytes=1092796-
Range: bytes=2378100-
Range: bytes=1093521-
Range: bytes=2429080-
Range: bytes=1093892-
Range: bytes=2472731-
Range: bytes=1094496-
Range: bytes=2513769-
Range: bytes=1094783-
Range: bytes=2562060-
Range: bytes=1095389-
Range: bytes=2611968-
Range: bytes=1095680-
Range: bytes=2661654-
Range: bytes=1095967-
Range: bytes=2713929-
Range: bytes=1096515-
Range: bytes=2767916-
Range: bytes=1096791-
Range: bytes=2827867-
Range: bytes=1097561-
Range: bytes=2895731-
Range: bytes=2013310-
Range: bytes=2958025-
Range: bytes=2013864-
Range: bytes=3022439-
Range: bytes=2014150-
Range: bytes=3091361-
Range: bytes=2014761-
Range: bytes=3157874-
Range: bytes=2015062-
Range: bytes=3225801-
Range: bytes=2015344-
Range: bytes=3294348-
Range: bytes=2015896-
Range: bytes=3364709-
Range: bytes=2016170-
Range: bytes=3435825-
Range: bytes=2016706-
Range: bytes=3507045-
Range: bytes=2017028-
Range: bytes=3580284-
Range: bytes=2017655-
Range: bytes=3646212-
Range: bytes=2018013-
Range: bytes=3709721-
Range: bytes=2018305-
Range: bytes=3776383-
Range: bytes=2018888-
Range: bytes=3845760-
Range: bytes=2019160-
Range: bytes=3918472-
Range: bytes=2889489-
Range: bytes=4062300-
Range: bytes=2889773-
Range: bytes=4136767-
Range: bytes=2890346-
Range: bytes=4209439-
Range: bytes=2890624-
Range: bytes=4286264-
Range: bytes=2891238-
ffmpeg -i http://localhost:8888/file/MKPuEVBF_PvV0T -f nut - 2>&1 >/dev/null
ffmpeg version git-2018-07-11-09628cb Copyright (c) 2000-2018 the FFmpeg developers
  built with Apple LLVM version 9.1.0 (clang-902.0.39.2)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD-09628cb --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-gpl --enable-ffplay --enable-libmp3lame --enable-libwebp --enable-libx264 --enable-libxvid --enable-opencl --enable-videotoolbox --disable-lzma
  libavutil      56. 18.102 / 56. 18.102
  libavcodec     58. 21.104 / 58. 21.104
  libavformat    58. 17.101 / 58. 17.101
  libavdevice    58.  4.101 / 58.  4.101
  libavfilter     7. 25.100 /  7. 25.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  2.100 /  5.  2.100
  libswresample   3.  2.100 /  3.  2.100
  libpostproc    55.  2.100 / 55.  2.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'http://localhost:8888/file/MKPuEVBF_PvV0T':
  Metadata:
    major_brand     : qt  
    minor_version   : 0
    compatible_brands: qt  
    creation_time   : 2018-08-08T09:52:51.000000Z
    com.apple.quicktime.location.ISO6709: +55.6747+012.5676+002.031/
    com.apple.quicktime.make: Apple
    com.apple.quicktime.model: iPhone 6
    com.apple.quicktime.software: 11.2.1
    com.apple.quicktime.creationdate: 2018-08-08T11:52:50+0200
  Duration: 00:00:20.18, start: 0.000000, bitrate: 15803 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080, 15698 kb/s, 29.98 fps, 29.97 tbr, 600 tbn, 1200 tbc (default)
    Metadata:
      creation_time   : 2018-08-08T09:52:51.000000Z
      handler_name    : Core Media Data Handler
      encoder         : H.264
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 94 kb/s (default)
    Metadata:
      creation_time   : 2018-08-08T09:52:51.000000Z
      handler_name    : Core Media Data Handler
    Stream #0:2(und): Data: none (mebx / 0x7862656D), 0 kb/s (default)
    Metadata:
      creation_time   : 2018-08-08T09:52:51.000000Z
      handler_name    : Core Media Data Handler
    Stream #0:3(und): Data: none (mebx / 0x7862656D), 0 kb/s (default)
    Metadata:
      creation_time   : 2018-08-08T09:52:51.000000Z
      handler_name    : Core Media Data Handler
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> mpeg4 (native))
  Stream #0:1 -> #0:1 (aac (native) -> mp3 (libmp3lame))

Change History (6)

comment:1 by Carl Eugen Hoyos, 6 years ago

Please provide the sample file.

comment:3 by Carl Eugen Hoyos, 6 years ago

Component: undeterminedavformat
Keywords: mov added
Version: unspecifiedgit-master

Isn't this just how the file is interleaved?

comment:4 by Timo R., 6 years ago

That's pretty much how mov/mp4 works. If you don't want it to seek like that, you'll need to download the file first, and then play the local copy. Using qt-faststart might make it a bit better, but it will still seek a lot.

comment:5 by ronag, 6 years ago

But it is just reading a few hundred bytes at a time. There has to be a better way to do that? Some kind of buffer or something which makes it reading in the file at least in a few thorns byte chunks.

comment:6 by Elon Musk, 5 years ago

Resolution: wontfix
Status: newclosed
Note: See TracTickets for help on using tickets.