Comments (6)
Ignoring unexpected segments (e3c4233) from ffmpeg seem to fix this issue. Those segments were typically very short in comparsion to expected segment length (200ms vs 4sec) and therefore significant amount of video playback was lost. By ignoring them we might still loose some slice of the media, because last segment is shorter than expected. But on the other side, the same rounding that was applied to last segment could be applied to the first segment in the the next trancsoding job and therefore compensate for the loss.
from go-transcode.
From https://man.archlinux.org/man/extra/ffmpeg/ffmpeg-all.1.en#time
If the argument consists of timestamps, ffmpeg will round the specified times to the nearest output timestamp as per the encoder time base and force a keyframe at the first frame having timestamp equal or greater than the computed timestamp
from go-transcode.
Current philisophy is, that we separate whole recording to discrete segments, and everytime that segment is requested we transcode it. Segments must be created at keyframes, but ffmpeg is rounding specified times and sometimes splitting them unexpectedly.
- We could fix this by allowing ffmpeg to have some sort of acepted offset where we account for the rounding.
- Another possibility is to give up seeking accuracy and start realtime encoding from the seek position. But this would mean, segments cannot be reused and cached, for every client watching VOD there must be custom process.
from go-transcode.
I spent a lot of time trying to fix this before giving up to create go-vod (it doesn't create separate ffmpeg processes, instead just sends a SIGSTOP to pause transcoding). The problem is this:
Say all segments are 3s in length, and I've a segment starting at t=6s. Then the segment might end at t=9s. When we try to create the next segment starting at t=9s, then ffmpeg starts it at some keyframe say t=9.1s. That means 100ms of video disappeared, which leads to weird playback bugs. It might be even worse -- the keyframe at which it ends may be before 9s. And there's nothing we can do about the approximations.
from go-transcode.
@pulsejet but that is optimized only for a single user, right? Correct me if I am worong, but the segments are not predictable; depending on where you started the playback their timing might be different. Therefore they cannot be cached and reused when two client would start watching at different time (example: second would be 5 min ahead of first one).
In that case, you are sending SIGSTOP
to stop transcoding too many segments, right? In that case maybe adding -re
without SIGSTOP
would yield the same results, but the CPU load would be distributed and not in peaks (only when transcoding).
from go-transcode.
@pulsejet but that is optimized only for a single user, right? Correct me if I am worong, but the segments are not predictable; depending on where you started the playback their timing might be different. Therefore they cannot be cached and reused when two client would start watching at different time (example: second would be 5 min ahead of first one).
Correct, there cannot be any caching since the start time must align if the user skips ahead. We can cache for the case where users don't skip, though, which might be the case for certain types of content.
In that case, you are sending
SIGSTOP
to stop transcoding too many segments, right? In that case maybe adding-re
withoutSIGSTOP
would yield the same results, but the CPU load would be distributed and not in peaks (only when transcoding).
The browser buffers ahead, so I'm not sure if/how -re
would allow that.
from go-transcode.
Related Issues (20)
- 2nd+ streams lead to errors that can cause some players to not work. HOT 12
- Some freezes with static files HOT 28
- Error on probe HOT 1
- Closing ffmpeg when isn't used HOT 4
- ffprobe cache HOT 9
- Custom m3u8 for map audio HOT 5
- Usage examples HOT 29
- Problem in the first segment in ffmpeg HOT 4
- add HLS decryptor
- static file access HOT 8
- Unrecognized option 'hls_wrap' from ffmpeg HOT 3
- Add hardware acceleration support for static files HOT 2
- Questions on simultaneous ffmpeg processes (NVENC job concurrency) and segment buffering behavior HOT 8
- hlsvod: add cleanup strategy
- hlsvod: add NVIDIA GPU support
- Adaptiv Bitrates HOT 6
- Dreambox (Enigma2) as live Input HOT 2
- problem when accessing video from chrome or other browser: HOT 6
- Question: mp4 proxy HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go-transcode.