Opened 2 years ago

Closed 2 years ago

#9747 closed defect (fixed)

Specified User-Agent is only being applied to the first input stream

Reported by: elyse0 Owned by:
Priority: normal Component: undetermined
Version: git-master Keywords: user-agent, lavf
Cc: elyse0 Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Context
I was looking into a yt-dlp issue that I encountered myself (https://github.com/yt-dlp/yt-dlp/issues/2696), where we wanted to merge two streams (audio+video) to stdout, but kept getting 403 Forbidden.

After some digging, I found that ffmpeg was sending the default User-Agent (Lavf/$version) for the second stream, ignoring the provided UA and causing that error.

Summary of the bug:
When we specify an 'User-Agent', it is only being applied to the first input stream, using the default 'Lavf/$version' for the second one.

And when the host only accepts certain headers, the download will fail.

Expected behavior:
The supplied User-Agent should be applied to all input streams.

How to reproduce:
I have reproduced the issue by rejecting all requests on the S3 bucket, that contain "Lavf*" in the User-Agent.

% ffmpeg -v debug \
         -user_agent "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:99.0) Gecko/20100101 Firefox/99.0" \
         -i http://ffmpeg-bug.s3-website-us-east-1.amazonaws.com/video/video.m3u8 \
         -i http://ffmpeg-bug.s3-website-us-east-1.amazonaws.com/audio/audio.m3u8 \
         ncs-seconds.mp4

ffmpeg version N-61656-gfbd22504c4-static https://johnvansickle.com/ffmpeg/
built on 20220422

Attachments (2)

ffmpeg-20220425-055516.log (8.0 KB ) - added by elyse0 2 years ago.
Ffmpeg log report
user-agent-second-stream.png (142.6 KB ) - added by elyse0 2 years ago.
Image highlighting the wrong User-Agent

Download all attachments as: .zip

Change History (3)

by elyse0, 2 years ago

Attachment: ffmpeg-20220425-055516.log added

Ffmpeg log report

by elyse0, 2 years ago

Image highlighting the wrong User-Agent

comment:1 by elyse0, 2 years ago

Resolution: fixed
Status: newclosed

After some thought, I think this is expected behavior because it allows us to set http headers per stream.

Note: See TracTickets for help on using tickets.