Add User Agent Header Support
Add user agent header support for FFmpeg & FFprobe. In FFmpeg, -user_agent arg must come before -i, therefore can't use .addArguments.
Hello @ssysm , I have found checked you PR and found that you probably missed how FFmpeg command line is generated. You add header property directly to FFmpeg, but you should do that for BaseInOut or BaseInput.
To make your code work without need to add extra property you should use UrlInput#addArguments instead of FFmpeg#addArguments.
Hi @kokorin! Thanks for reviewing my PR request, I have looked UrlInput#addArguments and it works! I moved the add User-Agent header part to UrlInput.
After 2nd commit there is no corresponding argument in FFprobe. Also it would b great to have tests that header is passed to input source. Is the same option applicable to ffmpeg output?
I added the argument in FFprobe in the Input interface, but there's seems like a problem for class that is extending from SocketInput since it implemented on the Input interface. To keep constancy, I just simply return null when it tries to access the getter/setter method for userAgent (Since User-Agent is an HTTP only option). There's no output option for User-Agent since that is only a requesting only header.
On the point of testing, there's not very easy to test HTTP header related task with FFmpeg since it requires an HTTP Server with a valid media. But I do see you have an FTP Test Server setup, it would be better if you switch it to an HTTP Server.(TL;DR: Possible, but need some refactoring to test system.)
FFprobe can't handle multiple inputs, so all arguments are added directly to FFprobe, not Input.
Also setter on Input would contradict to FFprobe#setInput(String).
I can't accept PR without tests. It's possible to test it with simple TCP socket, since we are interested only in headers which ffmpeg passes in. When ffmpeg has sent Http request it's possible to close connection. FFmpeg with fail in that case, but that would be expected and can be suppressed in tests.
Switching to HttpServer isn't very good, since HTTP uses Base64 encoding for binary data, so it would require additional time spent on encoding/decoding plus 25% overhead in size.
Thanks for reviewing my code! I have added a testing HTTP server, the server will return 400 if the FFmpeg fails to set the correct User-Agent header.
Interesting.. some of the CI checks is giving EOF error, I'll check again and try to reproduce the error on my end and see what's wrong.