Open amajio opened 1 month ago
first I apologies if anything wrong , All code from asking ChatGPT and working fine for me XD. and some fix from Pull requests >> Fix status updates spam and configuration video file extension https://github.com/lossless1024/StreaMonitor/pull/114 https://github.com/lossless1024/StreaMonitor/pull/136
Hello, can you submit the code? This allows you to visually view code changes
Hello, can you submit the code? This allows you to visually view code changes
Honestly i don't know how to do it, it's look complicated to me so i put in this section sorry :P
All right, how's it going so far? Will video freezes or video loss still occur after changing to ts format? In the previous mp4 format, the video would stop at 4 seconds, then suddenly jump to 10 seconds, and the screen would return to normal.
All right, how's it going so far? Will video freezes or video loss still occur after changing to ts format? In the previous mp4 format, the video would stop at 4 seconds, then suddenly jump to 10 seconds, and the screen would return to normal.
I was record with mp4 before and it's broken can't recovery or fix video file so .ts is the best for me, but I don't think video freeze or loss cause by video extension
.ts just leads to a MPEG-TS (MPEG Transport Stream). That's more like a TV signal. It's pieced and can be processed on that level. Modern video players are able to play this also.
MKV as well as MP4 (a normal MPEG4 file) always corrupt because they are concepted a bit different.
The above code simply stops FFMPEG when the file reaches a said size. That's a bad idea when you don't want to lose parts.
Actually it's not implemented but the solution would be a post processing mechanism. With that it would be possible to convert a MPEG-TS to a valid MP4 and do some splitting by time or size (size might be a bit more complex because it's not supported by FFMPEG out of the box as far as I know).
Thank you for info and suggestion, With my knowledge I don't have good enough understanding about FFMPEG so this's only way I come up :P, to avoid lost parts on process stop and start new file you can put delay time.sleep(x) in process_terminate, For both file to overlap each other a little bit. by the way if you have a better way feel free to share it. XD
ffmpeg -i link ... -c copy -f mpegts file:filename.mp4.part # Get Stream as MPEG Transport Stream (MPEG-TS)
ffmpeg -i filename.mp4.part -f mp4 ... file:filename.mp4 # Make MPEG-TS to real MP4
mp4box -splits 2G filename.mp4 # Split by size - note that this might not be absolutely exact
mp4box -split 30M filename.mp4 # Split to 30 minute parts - note that this might not be absolutely exact
... do cleanup and moving
That's the simples solution I could find. mp4box is part of gpac which is part of all regular linux distros and Homebrew on macOS. A Windows Build can be also found on the project site (https://gpac.io/downloads/gpac-nightly-builds/)
Note: This produces heavy I/O load and general system load. Use NVMe's as storage and other suitable hardware. It's a bad idea to have this as a post procesing chain for a tool which at the core tries to fetch the data.
I implemented this, please check out.
./parameters.py
./streamonitor/downloaders/ffmpeg.py
./streamonitor/bot.py