Opened 8 years ago

Closed 8 years ago

#5358 closed defect (needs_more_info)

ffmpeg doesn't respect user-agent option when requesting EXT-X-MEDIA:TYPE=AUDIO

Reported by: Simon 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:
When requesting an audiostream (HLS version 4), ffmpeg doesn't use the supplied user-agent. The initial request to the master.m3u8 uses the correct user-agent. Problem both in ffmpeg and ffplay.

How to reproduce:

% ffplay -user-agent USERAGENT -i hlsv4url.m3u8

ffmpeg version N-78964-g5061579 Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 5.3.0 (GCC)

First request:

[http @ 00000245bd9abf00] request: GET URL/master.m3u8 HTTP/1.1
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36
Accept: */*
Range: bytes=0-
Connection: close
Host: XXX

Second request (for audio stream):

[http @ 00000245bd9bee40] request: GET URL/playlist128k.m3u8 HTTP/1.1
User-Agent: Lavf/57.28.100
Accept: */*
Connection: close
Host: XXX

Change History (7)

comment:1 by Carl Eugen Hoyos, 8 years ago

Component: ffmpegundetermined
Keywords: user-agent removed

Please provide the command line that allows to reproduce the issue together with the complete, uncut console output to make this a valid ticket.

comment:2 by Simon, 8 years ago

Command line:

ffmpeg -user-agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36 " -i http://localhost/master.m3u8 -loglevel debug

Complete output:

λ ffmpeg -user-agent "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36 " -i http://localhost/master.m3u8 -loglevel debug                                                                                                                                    
ffmpeg version N-78964-g5061579 Copyright (c) 2000-2016 the FFmpeg developers                                                                                                                                                            
  built with gcc 5.3.0 (GCC)                                                                                                                                                                                                             
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-lib
--enable-libdcadec --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmfx --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libo
-enable-librtmp --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack 
ble-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-decklink --enable-zlib                                                                                           
  libavutil      55. 19.100 / 55. 19.100                                                                                                                                                                                                 
  libavcodec     57. 28.100 / 57. 28.100                                                                                                                                                                                                 
  libavformat    57. 28.100 / 57. 28.100                                                                                                                                                                                                 
  libavdevice    57.  0.101 / 57.  0.101                                                                                                                                                                                                 
  libavfilter     6. 39.102 /  6. 39.102                                                                                                                                                                                                 
  libswscale      4.  0.100 /  4.  0.100                                                                                                                                                                                                 
  libswresample   2.  0.101 /  2.  0.101                                                                                                                                                                                                 
  libpostproc    54.  0.100 / 54.  0.100                                                                                                                                                                                                 
Splitting the commandline.                                                                                                                                                                                                               
Reading option '-user-agent' ... matched as AVOption 'user-agent' with argument 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36 '.                                   
Reading option '-i' ... matched as input file with argument 'http://localhost/master.m3u8                                                                                                                                                 
Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'.                                                                                                                                   
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 http://localhost/master.m3u8.          
Successfully parsed a group of options.                                                                                                                                                                                                  
Opening an input file: http://localhost.m3u8.                            
[http @ 00000245bd9abf00] Setting default whitelist 'http,https,tls,rtp,tcp,udp,crypto'                                                                                                                                                  
[http @ 00000245bd9abf00] request: GET /master.m3u8 HTTP/1.1                                      
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.87 Safari/537.36                                                                                                           
Accept: */*                                                                                                                                                                                                                              
Range: bytes=0-                                                                                                                                                                                                                          
Connection: close                                                                                                                                                                                                                        
Host: localhost                                                                                                                                                                                                                                                                                                                                                                                                                                      
                                                                                                                                                                                                                                         
[hls,applehttp @ 00000245bd9aaee0] Format hls,applehttp probed with size=2048 and score=100                                                                                                                                              
[http @ 00000245bd9bee40] request: GET /playlist128k.m3u8 HTTP/1.1                                                                                                                                               
User-Agent: Lavf/57.28.100                                                                                                                                                                                                               
Accept: */*                                                                                                                                                                                                                              
Connection: close                                                                                                                                                                                                                        
Host: localhost                                                                                                                                                                                                  
Icy-MetaData: 1                                                                                                                                                                                                                          
                                                                                                                                                                                                                                         
                                                                                                                                                                                                                                         
[http @ 00000245bd9bee40] HTTP error 403 Forbidden                                                                                                                                                                                       
[AVIOContext @ 00000245bd9ae220] Statistics: 6288 bytes read, 0 seeks                                                                                                                                                                    
http://localhost/master.m3u8: Server returned 403 Forbidden (access denied)     

The log is misleading though, when checking wireshark, only the call to playlist128k.m3u8 returns forbidden (because of user-agent).

comment:3 by Hendrik, 8 years ago

Please try a newer version, the user-agent option with HLS was fixed in some cases just last week.

in reply to:  3 comment:4 by Simon, 8 years ago

Replying to heleppkes:

Please try a newer version, the user-agent option with HLS was fixed in some cases just last week.

Which commits are you referring to? My build is this commit: https://github.com/FFmpeg/FFmpeg/commit/a7b8a6e704d3bea4a2bf724b6b6a3b1de1b08886

I see no changes to HLS after that, that would fix this problem.

comment:5 by Carl Eugen Hoyos, 8 years ago

Please test current FFmpeg git head to make this a valid ticket.

comment:6 by Simon, 8 years ago

I see no commits touching any code that should affect this issue, please specify which commit that fixes this. If you cannot provide that info, I'll try to fix it on my own, seems like an equal waste of time.

Feel free to close this issue.

Last edited 8 years ago by Simon (previous) (diff)

comment:7 by Carl Eugen Hoyos, 8 years ago

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