Opened 11 years ago

Closed 11 years ago

#2710 closed defect (fixed)

HTTP redirect 307 of an specified HLS url is not stored after HTTP connexion

Reported by: Sidney N'Guessan Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: hls http
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

If there is a HTTP redirect 307 on a specified url, the redirect is followed during the http connexion but is not stored.

In my compagny, TV streaming is done through HLS and load balancing. For a channel, the stream URL is forward to a temporary redirect.

Ex:
wget http://our-server/CH1/CH1.m3u8
--2013-06-25 16:00:59-- http://our-server/CH1/CH1.m3u8
Connecting to our-server:80... connected.
HTTP request sent, awaiting response... 307 Temporary Redirect
Location: http://our-server:80/CH1/kac3trwi5qcqy5iiartgtbfizjqet2ii/0000150/GlobalHlsManifest.m3u8 [following]
--2013-06-25 16:00:59-- http://our-server/CH1/kac3trwi5qcqy5iiartgtbfizjqet2ii/0000150/GlobalHlsManifest.m3u8
Connecting to our-server:80... connected.
HTTP request sent, awaiting response... 200 OK

In our case, ffplay does not play the m3u8 because the URL sent to the HLS stack is the same as give in parameter but not the real URL (redirected) and the result is 404.

/usr/bin/ffplay http://our-server/CH1/CH1.m3u8
avplay version 0.8.5-4:0.8.5-0ubuntu0.12.04.1, Copyright (c) 2003-2012 the Libav developers

built on Jan 24 2013 18:01:36 with gcc 4.6.3

[http @ 0x7f702c0043c0] HTTP error 404 Not Found
http://our-server/CH1/CH1.m3u8: Input/output error

I have fix this bug in the patch.

Sidney.

Attachments (1)

follow-http-redirect.patch (2.8 KB ) - added by Sidney N'Guessan 11 years ago.
Patch to follow HTTP redirect 307 on a specified URL

Download all attachments as: .zip

Change History (8)

by Sidney N'Guessan, 11 years ago

Attachment: follow-http-redirect.patch added

Patch to follow HTTP redirect 307 on a specified URL

comment:1 by Carl Eugen Hoyos, 11 years ago

Keywords: hls http added; HLS HTTP redirect 307 removed
Reproduced by developer: unset

Please test current git head from http://ffmpeg.org/download.html and please add a failing command line together with complete, uncut console output.

And please consider reading http://blog.pkh.me/p/13-the-ffmpeg-libav-situation.html to learn more about one (of several) FFmpeg forks that you originally tested.

comment:2 by bbcallen, 11 years ago

Here is a HLS url with the similar problem, which you can test against
http://gslb.tv.sohu.com/live?cid=12&type=hls

comment:3 by Carl Eugen Hoyos, 11 years ago

Reproduced by developer: set
Status: newopen
Type: enhancementdefect
Version: 1.0.7git-master

wget confirms that this is a problem about ignored redirect.

$ ffmpeg -loglevel 99 -i "http://gslb.tv.sohu.com/live?cid=12&type=hls"
ffmpeg version N-54477-g8fdec02 Copyright (c) 2000-2013 the FFmpeg developers
  built on Jul  5 2013 13:00:03 with gcc 4.7 (SUSE Linux)
  configuration: --enable-gpl --disable-indev=jack
  libavutil      52. 38.100 / 52. 38.100
  libavcodec     55. 18.101 / 55. 18.101
  libavformat    55. 11.100 / 55. 11.100
  libavdevice    55.  2.100 / 55.  2.100
  libavfilter     3. 78.100 /  3. 78.100
  libswscale      2.  3.100 /  2.  3.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  3.100 / 52.  3.100
Splitting the commandline.
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument '99'.
Reading option '-i' ... matched as input file with argument 'http://gslb.tv.sohu.com/live?cid=12&type=hls'.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option loglevel (set logging level) with argument 99.
Successfully parsed a group of options.
Parsing a group of options: input file http://gslb.tv.sohu.com/live?cid=12&type=hls.
Successfully parsed a group of options.
Opening an input file: http://gslb.tv.sohu.com/live?cid=12&type=hls.
[hls,applehttp @ 0x2ee4020] Format hls,applehttp probed with size=2048 and score=100
[http @ 0x2ef0520] HTTP error 404 Not Found
[hls,applehttp @ 0x2ee4020] Error when loading first segment 'http://gslb.tv.sohu.com/hls/12.ts?s=hWExFxqmZ8eE'
[AVIOContext @ 0x2ee8fe0] Statistics: 704 bytes read, 0 seeks
http://gslb.tv.sohu.com/live?cid=12&type=hls: Input/output error

comment:4 by Sidney N'Guessan, 11 years ago

Same problem with this URL "http://gslb.tv.sohu.com/live?cid=12&type=hls"

-- With orig libavformat of my distrib --

$ /usr/bin/ffplay "http://gslb.tv.sohu.com/live?cid=12&type=hls"
avplay version 0.8.5-4:0.8.5-0ubuntu0.12.04.1, Copyright (c) 2003-2012 the Libav developers

built on Jan 24 2013 18:01:36 with gcc 4.6.3

[http @ 0x7f97d000de20] HTTP error 404 Not Found
http://gslb.tv.sohu.com/live?cid=12&type=hls: Input/output error

-- With patched libavformat (chromium fork) --

/usr/local/bin/ffplay "http://gslb.tv.sohu.com/live?cid=12&type=hls"                                                                                                                                  
ffplay version 1.0.git Copyright (c) 2003-2012 the FFmpeg developers
  built on Jun  5 2013 18:40:50 with gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)
  configuration: --enable-avdevice --enable-avfilter --enable-fft --enable-rdft --enable-shared --disable-dxva2 --disable-vaapi --disable-vda --disable-vdpau --optflags=-O2 --enable-decoder='theora,vorbis,vp8' --enable-decoder='pcm_u8,pcm_s16le,pcm_s24le,pcm_f32le' --enable-decoder='pcm_s16be,pcm_s24be' --enable-demuxer='ogg,matroska,wav' --enable-parser='vp3,vorbis,vp8' --enable-pic --enable-decoder='aac,h264,mp3,flac,mpeg4,amrnb,amrwb,pcm_mulaw,gsm_ms' --enable-demuxer='mp3,mov,flac,avi,amr,gsm' --enable-parser='aac,h264,mpegaudio,flac,h263,mpeg4video,gsm'
  libavutil      52. 11.101 / 52. 11.101
  libavcodec     54. 78.101 / 54. 78.101
  libavformat    54. 42.100 / 54. 42.100
  libavdevice    54.  3.102 / 54.  3.102
  libavfilter     3. 23.105 /  3. 23.105
  libswscale      2.  1.103 /  2.  1.103
  libswresample   0. 17.102 /  0. 17.102
[mpegts @ 0x7fb58c010e40] Estimating duration from bitrate, this may be inaccurate
[hls,applehttp @ 0x7fb58c0008c0] Estimating duration from bitrate, this may be inaccurate
Input #0, hls,applehttp, from 'http://gslb.tv.sohu.com/live?cid=12&type=hls':
  Duration: 00:00:00.17, start: 11736.040178, bitrate: 33 kb/s
  Program 0 
    Metadata:
      variant_bitrate : 0
    Stream #0:0: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p, 640x480 [SAR 1:1 DAR 4:3], 12.50 fps, 25 tbr, 90k tbn, 50 tbc
    Stream #0:1: Audio: aac ([15][0][0][0] / 0x000F), 32000 Hz, mono, fltp, 34 kb/s
Frame changed from size:0x0 to size:640x480q=    5KB sq=    0B f=0/0   
11740.59 A-V: -0.007 fd=   6 aq=    5KB vq=    4KB sq=    0B f=0/0
Last edited 11 years ago by Carl Eugen Hoyos (previous) (diff)

in reply to:  4 comment:5 by Carl Eugen Hoyos, 11 years ago

Replying to fripooy:

With patched libavformat

Please send the patch to the ffmpeg-devel mailing list, be careful not to break ABI

Last edited 11 years ago by Carl Eugen Hoyos (previous) (diff)

comment:6 by Michael Niedermayer, 11 years ago

Not reproduceable with the public URL and ffmpeg git master
if this has been fixed, please close the ticket
thanks

comment:7 by Carl Eugen Hoyos, 11 years ago

Analyzed by developer: unset
Resolution: fixed
Status: openclosed

Fixed by Martin Storsjö since 9440e470 / 8c929098

Note: See TracTickets for help on using tickets.