Fix for FFmpeg "protocol not on whitelist" Error for HTTP(S) URLs


tl;dr:

Use -safe 0 and -protocol_whitelist file,http,https,tcp,tls arguments before the input arguments. Full example at very bottom.


I was trying to use FFmpeg's concat demuxer like so:

# inputs.txt
file 'http://www.example1.com/video1.mp4'
file 'https://www.example2.com/video2.mp4'
ffmpeg -f "concat" -i "./inputs.txt" -codec "copy" "./concated.mp4" 

First I got the error:

[concat @ 0x00] Unsafe file name 'http://www.example1.com/video1.mp4'
./inputs.txt: Operation not permitted

This was solved by adding the -safe 0 argument. Then I got the error:

[http @ 0x00] Protocol not on whitelist 'file,crypto'!
[concat @ 0x00] Impossible to open 'http://www.example1.com/video1.mp4'
./inputs.txt: Invalid argument

I thought I would be able to solve this by simple adding -protocol_whitelist file,http,https but then the error became:

[tcp @ 0x00] Protocol not on whitelist 'file,http,https'!
[concat @ 0x00] Impossible to open 'http://www.example1.com/video1.mp4'
./inputs.txt: Invalid argument

I did not understand why my HTTP protocol input was still being rejected. http was clearly in the protocol whitelist. Then I noticed the small diference between the previous two errors. Look at the very first word in those errors. http vs tcp. I realized that the first word in brackets before the error was the protocol that was being rejected.

The solution is to also add tcp to the protocol whitelist as well (also tls if you want to support HTTPS). Here was my final command:

ffmpeg -f "concat" -safe "0" -protocol_whitelist "file,http,https,tcp,tls" -i "./inputs.txt" -codec "copy" "./concated.mp4"