Giter Site home page Giter Site logo

Comments (5)

baSSiLL avatar baSSiLL commented on June 1, 2024 1

Yes, such approach is viable in case you can use "pull" model for obtaining video and audio data.
Yes, AVI format implies simultaneous start of all streams. How well they go in sync depends on whether actual rate of the data you write corresponds to what is set in a stream header. For instance, if you set 30 fps for video and actually write 25 frames per second while audio is written at the full rate then they will be out of sync during playback.

from sharpavi.

baSSiLL avatar baSSiLL commented on June 1, 2024 1

Pull model references to workflow when data consumer asks data provider if data available, often on periodic basis. In contrast push model implies data provider notifies data consumer when data becomes available.

from sharpavi.

baSSiLL avatar baSSiLL commented on June 1, 2024

Hi

Using multiple threads for writing video frames and audio blocks is possible. There is a synchronization code where actual writing to an underlying stream happens. Whether organize your code multi- or single-threaded depends on your workflow.
SharpAvi does not work with video/audio sources - it only handles data that you feed it. How you get this data is beyond the scope of this lib.

If you reference the code example in the wiki article - that's just a simple "Hello world" level sample. A sample screencasting app in the codebase is a more elaborate example. There you can find multi-threading, async writing, capturing audio (using NAudio library) etc.

FYI, AVI specs do not state any explicit interleaving scheme for video and audio - the format even permits no actual interleaving, when for instance all video is written first followed by all audio. However, in practice many players tend to "like" when video and audio are interleaved more or less evenly - say 1 video frame then 1 audio block then 1 video frame then 1 audio block etc.

from sharpavi.

AndersBillLinden avatar AndersBillLinden commented on June 1, 2024

Would it be a good idea to have only one thread for all the capturing taking screenshot after screenshot with a pause between every screenshot adapted to the desired framerate, but after each screenshot also check how much data there has arrived from the microphone and put that in the audio stream? Will the video playback assume that the sound is starting together with the first screenshot? How well will the images and the sound samples go in sync with each other? The method will consist of 1. take screenshot, 2. put in video stream 3. take data from the microphone 4. put in audio stream 5. compute the amount of time that should elapse before the next screenshot should be taken. 6. sleep that time 7. go back to 1?

from sharpavi.

AndersBillLinden avatar AndersBillLinden commented on June 1, 2024

What is "pull" model then? Video and audio will be fetched very differently because video will not fetch data that has automatically been streamed into an internal buffer like audio will. Maybe that is not related to the pull concept, so Iยดd better ask.

from sharpavi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.