Transcode server for remote
Huge thank you to @cal2195 for his code 🙇
This code comes from his transcoding-video branch 🥇
This is meant to be released in tandem with https://github.com/whyboris/Video-Hub-App-remote/pull/9 🤝
~Help wanted~
update: Thank you @cal2195 for the on-finished suggestion -- I think it fixed the below problem
When running this branch in tandem with the Remote - after a little bit (playing the video 10-20 times) the server fails:
x264 [error]: malloc of size 2840448 failed
Video encoding failed
I messed on my PC with the pagefile settings, so it could be me. But I also wonder if, since for every HTTP request that comes to this server, we're spawning a new ffmpeg process, and perhaps never killing it, something goes wrong? 😅
Help still wanted:
Also, I set '-frag_duration', '15' to test a different value, but originally it was 3600 ... I'm unsure about what it's meant to do - the unit is seconds, and 3600 is 1 hour which seems awfully long (though I still don't understand what the flag does) 😅
Documentation is conflicting (see comment in discussion below).
Sounds like you're correct - we need something like this to catch the connection closed event, and then .kill() the ffmpeg process, possibly with the correct signal: ⚠️
https://github.com/jshttp/on-finished
Also note, for MOV/MP4/ISMV (Smooth Streaming) muxer, -frag_duration is in _micro_seconds, not seconds! 😄
https://ffmpeg.org/ffmpeg-formats.html#Options-9
@cal2195 the FFmpeg documentation seems confusing 😅
frag_durationduration Set the length in seconds of fragments within segments (fractional value can be set).
-frag_durationduration Create fragments that are duration microseconds long.
:trollface:
Also, microseconds !?!! 😱 that's 1,000,000 microseconds in 1 second ... that's a million :trollface: ... they must have messed up in the documentation, right? Especially that they allow fractional value ... right? 😖
Thanks @cal2195 -- I think the on-finished did the trick: the server no longer crashes (no malloc error) 🤞 https://github.com/whyboris/Video-Hub-App/pull/611/commits/44ead957aa1be366c7e5e8b006c4bcd84f4f07a4
@cal2195 the FFmpeg documentation seems confusing 😅
frag_durationduration Set the length in seconds of fragments within segments (fractional value can be set).
-frag_durationduration Create fragments that are duration microseconds long.:trollface:
Also, microseconds !?!! 😱 that's 1,000,000 microseconds in 1 second ... that's a million :trollface: ... they must have messed up in the documentation, right? Especially that they allow fractional value ... right? 😖
The one that is in seconds is for the dash muxer, each muxer had it's own options. :) Only the one in seconds allows fractional values.
We want the mp4 muxer, which is in microseconds! 😄
I don't know what's a sensible values (as measured in seconds is). Is there a way to tell whether the value affects anything?
I can't see any difference whether it was 3600 as originally, or when it's 15 :trollface: - what would I expect to happen when I change it? Perhaps it gets ignored if it's too short to matter, and any effect is only noticeable at values above 1 million (1second)?
Sorry to ask about questions that I should be able to research on my own -- but the documentation is so terse 😕 I glanced around online (not too long, just a quick search) and found nothing of value to explain.
Or if it's easier, please let me know how you figured this stuff out 🙇