Search code examples
httpffmpegwebassemblyemscripten

ffmpeg emscripten hangs inside tcp_open


I've build ffmpeg from sources in emscripten. But can't get it to open http file in a web app in emscripten. I'm calling avformat_open_input() with http://server.com/file.mpg. Ffmpeg tries to establish a tcp connection to tcp://server.com:80 and hangs inside tcp_open(). I can see the server prints "GET / HTTP/1.1" 200 but the response doesn't seem to reach back to ffmpeg.

I suspect the browser blocks this connection. Is there way to make it work?


Solution

  • For anyone having to use ffmpeg in emscripten. I ended up implementing my own AVIOContext with custom implementations of read and seek functions. Then pass this context to avformat_open_input().