Opened 3 years ago

#4974 new defect

Cannot download HLS streams (.m3u8 files) with "-codec copy" in latest versions

Reported by: hello23 Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:

I was using ffmpeg to download HLS streams (from .m3u8 files) to .mkv files, with "-codec copy". I decided to upgrade to the latest ffmpeg version and noticed that it doesn't work anymore, and results in an error.
I tried it on some versions available here (I am using Windows 7 64-bit): http://ffmpeg.zeranoe.com/builds/win64/static/?C=M;O=D
and it works up until ffmpeg-20150109-git-d1c6b7b, and since ffmpeg-20150110-git-4df01d5 up to the latest version (ffmpeg-20151028-git-dd36749) it shows an error.

How to reproduce:

For the example I am using an HLS stream from the ones found here: http://stackoverflow.com/questions/10104301/hls-streaming-video-url-need-for-testing/13265943#13265943

% ffmpeg -i http://qthttp.apple.com.edgesuite.net/1010qwoeiuryfg/sl.m3u8 -codec copy vid.mkv

ffmpeg version N-68994-g4df01d5 Copyright (c) 2000-2015 the FFmpeg developers
  built on Jan  9 2015 22:13:35 with gcc 4.9.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnu
tls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-
libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-l
ibrtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --
enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --ena
ble-libxvid --enable-lzma --enable-decklink --enable-zlib
  libavutil      54. 16.100 / 54. 16.100
  libavcodec     56. 20.100 / 56. 20.100
  libavformat    56. 18.100 / 56. 18.100
  libavdevice    56.  3.100 / 56.  3.100
  libavfilter     5.  7.100 /  5.  7.100
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  3.100 / 53.  3.100
Input #0, hls,applehttp, from 'http://qthttp.apple.com.edgesuite.net/1010qwoeiuryfg/sl.m3u8':
  Duration: 01:29:25.00, start: 0.100100, bitrate: 0 kb/s
  Program 0
    Metadata:
      variant_bitrate : 688301
    Stream #0:0: Video: h264 (Baseline) ([27][0][0][0] / 0x001B), yuv420p(tv), 640x360 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
    Metadata:
      variant_bitrate : 688301
    Stream #0:1: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 8 kb/s
    Metadata:
      variant_bitrate : 688301
  Program 1
    Metadata:
      variant_bitrate : 165135
    Stream #0:2: Video: h264 (Baseline) ([27][0][0][0] / 0x001B), yuv420p(tv), 400x224 [SAR 1:1 DAR 25:14], 10 fps, 9.99 tbr, 90k tbn, 19.98 tbc
    Metadata:
      variant_bitrate : 165135
    Stream #0:3: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 15 kb/s
    Metadata:
      variant_bitrate : 165135
  Program 2
    Metadata:
      variant_bitrate : 262346
    Stream #0:4: Video: h264 (Baseline) ([27][0][0][0] / 0x001B), yuv420p(tv), 640x360 [SAR 1:1 DAR 16:9], 14.99 fps, 14.99 tbr, 90k tbn, 29.97 tbc
    Metadata:
      variant_bitrate : 262346
    Stream #0:5: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 10 kb/s
    Metadata:
      variant_bitrate : 262346
  Program 3
    Metadata:
      variant_bitrate : 481677
    Stream #0:6: Video: h264 (Baseline) ([27][0][0][0] / 0x001B), yuv420p(tv), 400x224 [SAR 1:1 DAR 25:14], 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
    Metadata:
      variant_bitrate : 481677
    Stream #0:7: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 8 kb/s
    Metadata:
      variant_bitrate : 481677
  Program 4
    Metadata:
      variant_bitrate : 1308077
    Stream #0:8: Video: h264 (Baseline) ([27][0][0][0] / 0x001B), yuv420p(tv), 640x360 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
    Metadata:
      variant_bitrate : 1308077
    Stream #0:9: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 8 kb/s
    Metadata:
      variant_bitrate : 1308077
  Program 5
    Metadata:
      variant_bitrate : 1927853
    Stream #0:10: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(tv), 960x540 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
    Metadata:
      variant_bitrate : 1927853
    Stream #0:11: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 8 kb/s
    Metadata:
      variant_bitrate : 1927853
  Program 6
    Metadata:
      variant_bitrate : 2650941
    Stream #0:12: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(tv), 960x540 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
    Metadata:
      variant_bitrate : 2650941
    Stream #0:13: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, mono, fltp, 40 kb/s
    Metadata:
      variant_bitrate : 2650941
  Program 7
    Metadata:
      variant_bitrate : 3477293
    Stream #0:14: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(tv), 1280x720 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
    Metadata:
      variant_bitrate : 3477293
    Stream #0:15: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 8 kb/s
    Metadata:
      variant_bitrate : 3477293
[matroska @ 0000000008efa840] Error parsing AAC extradata, unable to determine samplerate.
Output #0, matroska, to 'vid.mkv':
  Metadata:
    encoder         : Lavf56.18.100
    Stream #0:0: Video: h264 (H264 / 0x34363248), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 29.97 fps, 29.97 tbr, 1k tbn, 90k tbc
    Metadata:
      variant_bitrate : 3477293
    Stream #0:1: Audio: aac ([255][0][0][0] / 0x00FF), 48000 Hz, stereo, 8 kb/s
    Metadata:
      variant_bitrate : 688301
Stream mapping:
  Stream #0:14 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Could not write header for output file #0 (incorrect codec parameters ?): Error number -22 occurred

D:\temp>ffmpeg -i http://qthttp.apple.com.edgesuite.net/1010qwoeiuryfg/sl.m3u8 -codec copy vid.mkv
ffmpeg version N-76347-gdd36749 Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 5.2.0 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnu
tls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libdcadec --enable-libfreetype --enable-libgme --enab
le-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable
-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --ena
ble-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --e
nable-libxavs --enable-libxvid --enable-lzma --enable-decklink --enable-zlib
  libavutil      55.  5.100 / 55.  5.100
  libavcodec     57. 12.100 / 57. 12.100
  libavformat    57. 11.100 / 57. 11.100
  libavdevice    57.  0.100 / 57.  0.100
  libavfilter     6. 14.101 /  6. 14.101
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.100 /  2.  0.100
  libpostproc    54.  0.100 / 54.  0.100
Input #0, hls,applehttp, from 'http://qthttp.apple.com.edgesuite.net/1010qwoeiuryfg/sl.m3u8':
  Duration: 01:29:25.00, start: 0.100100, bitrate: 0 kb/s
  Program 0
    Metadata:
      variant_bitrate : 688301
    Stream #0:0: Video: h264 (Baseline) ([27][0][0][0] / 0x001B), yuv420p(tv), 640x360 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
    Metadata:
      variant_bitrate : 688301
    Stream #0:1: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 8 kb/s
    Metadata:
      variant_bitrate : 688301
  Program 1
    Metadata:
      variant_bitrate : 165135
    Stream #0:2: Video: h264 (Baseline) ([27][0][0][0] / 0x001B), yuv420p(tv), 400x224 [SAR 1:1 DAR 25:14], 10 fps, 9.99 tbr, 90k tbn, 19.98 tbc
    Metadata:
      variant_bitrate : 165135
    Stream #0:3: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 15 kb/s
    Metadata:
      variant_bitrate : 165135
  Program 2
    Metadata:
      variant_bitrate : 262346
    Stream #0:4: Video: h264 (Baseline) ([27][0][0][0] / 0x001B), yuv420p(tv), 640x360 [SAR 1:1 DAR 16:9], 14.99 fps, 14.99 tbr, 90k tbn, 29.97 tbc
    Metadata:
      variant_bitrate : 262346
    Stream #0:5: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 10 kb/s
    Metadata:
      variant_bitrate : 262346
  Program 3
    Metadata:
      variant_bitrate : 481677
    Stream #0:6: Video: h264 (Baseline) ([27][0][0][0] / 0x001B), yuv420p(tv), 400x224 [SAR 1:1 DAR 25:14], 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
    Metadata:
      variant_bitrate : 481677
    Stream #0:7: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 8 kb/s
    Metadata:
      variant_bitrate : 481677
  Program 4
    Metadata:
      variant_bitrate : 1308077
    Stream #0:8: Video: h264 (Baseline) ([27][0][0][0] / 0x001B), yuv420p(tv), 640x360 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
    Metadata:
      variant_bitrate : 1308077
    Stream #0:9: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 8 kb/s
    Metadata:
      variant_bitrate : 1308077
  Program 5
    Metadata:
      variant_bitrate : 1927853
    Stream #0:10: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(tv), 960x540 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
    Metadata:
      variant_bitrate : 1927853
    Stream #0:11: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 8 kb/s
    Metadata:
      variant_bitrate : 1927853
  Program 6
    Metadata:
      variant_bitrate : 2650941
    Stream #0:12: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(tv), 960x540 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
    Metadata:
      variant_bitrate : 2650941
    Stream #0:13: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, mono, fltp, 40 kb/s
    Metadata:
      variant_bitrate : 2650941
  Program 7
    Metadata:
      variant_bitrate : 3477293
    Stream #0:14: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(tv), 1280x720 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc
    Metadata:
      variant_bitrate : 3477293
    Stream #0:15: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 8 kb/s
    Metadata:
      variant_bitrate : 3477293
[matroska @ 0000000006822a80] Codec for stream 0 does not use global headers but container format requires global headers
[matroska @ 0000000006822a80] Codec for stream 1 does not use global headers but container format requires global headers
[matroska @ 0000000006822a80] Error parsing AAC extradata, unable to determine samplerate.
Output #0, matroska, to 'vid.mkv':
  Metadata:
    encoder         : Lavf57.11.100
    Stream #0:0: Video: h264 (H264 / 0x34363248), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 29.97 fps, 29.97 tbr, 1k tbn, 90k tbc
    Metadata:
      variant_bitrate : 3477293
    Stream #0:1: Audio: aac ([255][0][0][0] / 0x00FF), 48000 Hz, stereo, 8 kb/s
    Metadata:
      variant_bitrate : 688301
Stream mapping:
  Stream #0:14 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument

Change History (0)

Note: See TracTickets for help on using tickets.