I need to pass http headers (user agent and ip) to an ffmpeg command.
I use the following command:
ffmpeg -y -timeout 5000000 -map 0:0 -an -sn -f md5 - -headers "User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36" -headers "X-Forwarded-For: 13.14.15.66" -i ""
And I run a local node.js server to see the headers I get:
'use strict';
var express = require('express');
var server = express();
server.all('/*', function(req, res) {
console.log(JSON.stringify(req.headers));
res.sendFile('SampleVideo_1080x720_1mb.mp4', {root: '.'});
});
server.listen(80);
I keep getting an error saying "No trailing CRLF found in HTTP header." and the request is stuck.
If I drop the headers - everything works normally.
I also tried putting both headers in one string, but any line breaking character I used (\r\n, \r\n, etc.) didn't work.
Can someone help me figure out how to write this command correctly with the headers included?
3 Answers
Short Answer
Make sure you're using the latest ffmpeg, and use the -user-agent option.