Specified User-Agent is only being applied to the first input stream
|Reported by:||elyse0||Owned by:|
|Blocking:||Reproduced by developer:||no|
|Analyzed by developer:||no|
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.
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