Opened 5 years ago

Last modified 3 years ago

#1291 reopened defect

The custom user-agent option is ignored after the initial connection when using HTTP Live Streaming (HLS)

Reported by: xnp Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: hls
Cc: blappv@gmail.com Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Hello.

The "-user-agent" option is ignored after the initial connection to an HLS server.

When running this command line:
ffmpeg -user-agent myuseragent http://someserver/playlist.m3u8 -c copy -

I get this network dump for the initial connection to someserver:

GET /playlist.m3u8 HTTP/1.1.
User-Agent: myuseragent
...

But in the (automated) consecutive connections (after the initial .ts segments are consumed) I see this:

GET /playlist.m3u8 HTTP/1.1.
User-Agent: Lavf54.3.100.
...

Which means that the custom user-agent option is somehow ignored after the initial connection to the server.

Version: ffmpeg version N-40092-g3bbf3f7
OS: Windows (MinGW)

Change History (5)

comment:1 follow-up: Changed 5 years ago by cehoyos

  • Component changed from undetermined to avformat
  • Keywords hls added; user-agent HLS HTTP Live Streaming removed

Please add complete, uncut console output.

comment:2 in reply to: ↑ 1 Changed 5 years ago by xnp

Replying to cehoyos:

Please add complete, uncut console output.

This snippet:

GET /playlist.m3u8 HTTP/1.1.
User-Agent: Lavf54.3.100.
...

is observed via the network diagnostics tool "tcpdump" and not the console.

The console does not output anything regarding the user-agent at all.
But here it is:

ffmpeg version N-40092-g3bbf3f7 Copyright (c) 2000-2012 the FFmpeg developers

built on Apr 24 2012 00:55:38 with gcc 4.6.3
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-runtime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libass --enable-libcelt --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libnut --enable-libopenjpeg --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libutvideo --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
libavutil 51. 47.100 / 51. 47.100
libavcodec 54. 15.100 / 54. 15.100
libavformat 54. 3.100 / 54. 3.100
libavdevice 53. 4.100 / 53. 4.100
libavfilter 2. 72.100 / 2. 72.100
libswscale 2. 1.100 / 2. 1.100
libswresample 0. 11.100 / 0. 11.100
libpostproc 52. 0.100 / 52. 0.100

[hls,applehttp @ 0225d9c0] Format hls,applehttp probed with size=2048 and score=100
Format mpegts probed with size=2048 and score=100
[mpegts @ 023482e0] stream=0 stream_type=1b pid=21 prog_reg_desc=
[mpegts @ 023482e0] stream=1 stream_type=f pid=24 prog_reg_desc=
[hls,applehttp @ 0225d9c0] File position before avformat_find_stream_info() is 1959
[mpegts @ 023482e0] Continuity check failed for pid 0 expected 1 got 3
[NULL @ 02347780] Current profile doesn't provide more RBSP data in PPS, skipping
[hls,applehttp @ 0225d9c0] All info found
[hls,applehttp @ 0225d9c0] File position after avformat_find_stream_info() is 1959
Input #0, hls,applehttp, from 'http://someserver/playlist.m3u8':

Duration: N/A, start: 48533.090044, bitrate: N/A

Stream #0:0, 21, 1/90000: Video: h264 (Constrained Baseline) ([27][0][0][0] / 0x001B), yuv420p, 640x360, 1/50, 25 tbr, 90k tbn, 50 tbc
Stream #0:1, 18, 1/90000: Audio: aac ([15][0][0][0] / 0x000F), 44100 Hz, stereo, s16

Error parsing AAC extradata, unable to determine samplerate.
Output #0, matroska, to 'nul':

Metadata:

encoder : Lavf54.3.100
Stream #0:0, 0, 1/1000: Video: h264 ([27][0][0][0] / 0x001B), yuv420p, 640x360, 1/90000, q=2-31, 1k tbn, 90k tbc
Stream #0:1, 0, 1/1000: Audio: aac ([15][0][0][0] / 0x000F), 44100 Hz, stereo

Stream mapping:

Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)

Press [q] to stop, ? for help
...

comment:3 Changed 4 years ago by cehoyos

  • Resolution set to fixed
  • Status changed from new to closed
  • Version changed from unspecified to git-master

Fixed by Micah Galizia.

comment:4 Changed 4 years ago by blappv

  • Cc blappv@gmail.com added
  • Resolution fixed deleted
  • Status changed from closed to reopened

I passed user-agent "User-Agent: My MX Player/1.0" within other custom headers (cookie) with url "http://devimages.apple.com/iphone/samples/bipbop/gear1/prog_index.m3u8":

The first request was sent as expected:

GET /devimages.apple.com/iphone/samples/bipbop/gear1/prog_index.m3u8 HTTP/1.1
Accept: */*
Connection: close
Host: devimages.apple.com
User-Agent: My MX Player/1.0
Cookie: mobileuser=blapp

But the subsequence requests ignored the custom headers:

GET /devimages.apple.com/iphone/samples/bipbop/gear1/fileSequence0.ts HTTP/1.1
User-Agent: Lavf54.63.102
Accept: */*
Connection: close
Host: devimages.apple.com


The original issue was reported at https://groups.google.com/forum/?fromgroups=#!topic/mx-videoplayer/w4rpkK66zMc

comment:5 Changed 3 years ago by cehoyos

Ticket #2485 contains another example of a not-forwarded option.

Note: See TracTickets for help on using tickets.