Search code examples
ffmpeguser-agent

FFMPEG ignoring attempts to set user agent or other headers


I am on Windows, using the latest build from Zeranoe which was linked on the ffmpeg site.

My command is:

ffmpeg.exe -headers 'User-Agent: "This does not Work"' -protocol_whitelist file,http,https,tcp,tls,crypto  -i "local.m3u8" -c copy "out.mp4" -v trace

My local.m3u8 file is:

#EXTM3U
#EXT-X-TARGETDURATION:10
#EXTINF:10.000,
http://127.0.0.1/
#EXT-X-ENDLIST

On localhost I have a simple server running that logs the user agent. It outputs:

{ 'user-agent': 'Lavf/58.29.100',
  accept: '*/*',
  connection: 'keep-alive',
  host: '127.0.0.1',
  'icy-metadata': '1' }

The user agent has not been set. I have tried using -user-agent "test" and -user_agent "test" instead of -header, and have tried putting the arguments in a different order, no success. The trace Output of -v trace is https://pastebin.com/raw/W9hsjraT

Why is the User Agent not being overwritten, and how can I overwrite it?


Solution

  • It seems that FFMPEG only sends the custom headers if the input m3u8 is accessed via http/s, not if it is a local file. Thanks @Gyan for this.