Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can I encode input video frames via stream using their precise timestamps? #924

Open
1 of 2 tasks
bahmutov opened this issue Jul 24, 2019 · 0 comments
Open
1 of 2 tasks

Comments

@bahmutov
Copy link

Version information

  • fluent-ffmpeg version: 2.1.2
  • ffmpeg version: N-92718-g092cb17983-tessus
  • OS: Darwin

Code to reproduce

Currently, we are capturing browser (Chrome, Electron) video recording and using wallclock as timestamps

cmd = ffmpeg({
  source: pt
  priority: 20
})
.inputFormat("image2pipe")
.inputOptions("-use_wallclock_as_timestamps 1")
.videoCodec("libx264")
.outputOptions("-preset ultrafast")
// where pt is 
const stream = require("stream")
const pt = stream.PassThrough()

The thing is - each frame that arrives from Chrome has its own precise timestamp

chromeProps.screencastFrame = (e) => {
  // e.metadata.timestamp is 1563996507.297449 for example
  // https://chromedevtools.github.io/devtools-protocol/tot/Page#event-screencastFrame
  pt.write(new Buffer(e.data, 'base64'))
}

It would be nice to pass the precise frame timestamp instead of using wallclock timestamps - because frames might arrive slightly late due to CPU being busy. But so far I have not seen any docs on ffmpeg site or here that would match the requirement. Seems it is always either constant frame rate or wallclock timestamps, but never my custom timestamps.

Checklist

  • I have read the FAQ
  • I tried the same with command line ffmpeg and it works correctly (hint: if the problem also happens this way, this is an ffmpeg problem and you're not reporting it to the right place)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant