Opened 10 years ago

Closed 9 years ago

#4126 closed defect (fixed)

FFMPEG is very slow when trying to use a http url as source

Reported by: Srikanth Kotagiri Owned by:
Priority: important Component: ffmpeg
Version: git-master Keywords: http
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

Whenever I try to use a HTTP url as source for trancoding/muxing, the task completes successfully, but the time taken is an order of magnitude longer that just downloading the file and performing the operation locally.

I want to extract audio streams from sources online and I do not have the disk space locally to download the entire file. Is there any faster way to do this?

How to reproduce:

ffmpeg -i http://ftp.nluug.nl/pub/graphics/blender/demo/movies/Sintel.2010.720p.mkv -vn test.wav
ffmpeg version 2.4.2 Copyright (c) 2000-2014 the FFmpeg developers
  built on Oct 14 2014 15:31:40 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
  configuration: 
  libavutil      54.  7.100 / 54.  7.100
  libavcodec     56.  1.100 / 56.  1.100
  libavformat    56.  4.101 / 56.  4.101
  libavdevice    56.  0.100 / 56.  0.100
  libavfilter     5.  1.100 /  5.  1.100
  libswscale      3.  0.100 /  3.  0.100
  libswresample   1.  1.100 /  1.  1.100

Patches should be submitted to the ffmpeg-devel mailing list and not this bug tracker.

Change History (7)

comment:1 by compn, 10 years ago

Resolution: needs_more_info
Status: newclosed

how much longer? ffmpeg has to read the entire file to extract the audio. it cannot just read the audio remotely and not download the video packets.

using wget it says ETA 28 minutes.

comment:2 by Carl Eugen Hoyos, 10 years ago

Keywords: http mkv added; network performance removed

comment:3 by Sylvain Chevalier, 9 years ago

There is indeed an issue there, but only when transcoding from a video to an audio file (even with "copy" codec). Note that wget is much slower than curl, which is consistent with ffmpeg download time when it is working properly. There is a 4x factor in time when trying to get the audio from a URL of a video file:

time wget http://ispikit.com/installers/P1040120.mp4
real 0m21.661s
user 0m0.013s
sys 0m0.061s

time curl http://ispikit.com/installers/P1040120.mp4 > hello.mp4
real 0m12.465s
user 0m0.011s
sys 0m0.043s

time ffmpeg -i http://ispikit.com/installers/P1040120.mp4 -codec copy hello_1.mp4
real 0m12.869s
user 0m0.046s
sys 0m0.041s

time ffmpeg -i http://ispikit.com/installers/P1040120.mp4 -acodec copy hello_1.aac
real 0m49.236s
user 0m0.060s
sys 0m0.043s

time ffmpeg -i P1040120.mp4 -codec copy hello_2.mp4
real 0m0.040s
user 0m0.025s
sys 0m0.014s

time ffmpeg -i P1040120.mp4 -acodec copy hello_2.aac
real 0m0.029s
user 0m0.021s
sys 0m0.007s

comment:4 by Sylvain Chevalier, 9 years ago

Keywords: audio added; mkv removed
Resolution: needs_more_info
Status: closedreopened

comment:5 by Carl Eugen Hoyos, 9 years ago

Component: avformatffmpeg
Keywords: audio removed
Priority: normalimportant
Reproduced by developer: set
Version: unspecifiedgit-master

Regression since 574dcb5b / 13f6917c

comment:6 by Carl Eugen Hoyos, 9 years ago

Status: reopenedopen

The command (often) works without -vn

$ ffmpeg -i http://samples.ffmpeg.org/MPEG-4/video.mp4 -f null -vn -
ffmpeg version N-72747-ga4557b7 Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.7 (SUSE Linux)
  configuration: --enable-gpl
  libavutil      54. 27.100 / 54. 27.100
  libavcodec     56. 41.100 / 56. 41.100
  libavformat    56. 36.100 / 56. 36.100
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 16.101 /  5. 16.101
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.100 /  1.  2.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'http://samples.ffmpeg.org/MPEG-4/video.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 0
    compatible_brands: mp41
    creation_time   : 2008-12-15 20:31:58
  Duration: 00:02:47.23, start: 0.000000, bitrate: 1333 kb/s
    Stream #0:0(eng): Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D), yuv420p, 320x240 [SAR 1:1 DAR 4:3], 1191 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 29.97 tbc (default)
    Metadata:
      creation_time   : 2008-12-15 20:31:58
    Stream #0:1(eng): Data: none (rtp  / 0x20707472), 27 kb/s
    Metadata:
      creation_time   : 2008-12-15 20:32:08
    Stream #0:2(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 97 kb/s (default)
    Metadata:
      creation_time   : 2008-12-15 20:32:10
    Stream #0:3(eng): Data: none (rtp  / 0x20707472), 13 kb/s
    Metadata:
      creation_time   : 2008-12-15 20:32:10
    Stream #0:4(eng): Data: none (mp4s / 0x7334706D), 0 kb/s (default)
    Metadata:
      creation_time   : 2008-12-15 20:32:11
    Stream #0:5(eng): Data: none (mp4s / 0x7334706D) (default)
    Metadata:
      creation_time   : 2008-12-15 20:32:11
Output #0, null, to 'pipe:':
  Metadata:
    major_brand     : isom
    minor_version   : 0
    compatible_brands: mp41
    encoder         : Lavf56.36.100
    Stream #0:0(eng): Audio: pcm_s16le, 44100 Hz, stereo, s16, 1411 kb/s (default)
    Metadata:
      creation_time   : 2008-12-15 20:32:10
      encoder         : Lavc56.41.100 pcm_s16le
Stream mapping:
  Stream #0:2 -> #0:0 (aac (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x1e781c0] stream 2, offset 0x32a42c: partial file
http://samples.ffmpeg.org/MPEG-4/video.mp4: Invalid data found when processing input
size=N/A time=00:00:19.41 bitrate=N/A
video:0kB audio:3344kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

comment:7 by Michael Niedermayer, 9 years ago

Resolution: fixed
Status: openclosed
Note: See TracTickets for help on using tickets.