Comments (5)
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.
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.
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.
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.
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)
- x264vfw Record Error.. HOT 2
- Screen recording as video, audio on SharpAvi - Audio not recording HOT 4
- .NET Core target HOT 1
- This Library not available in .NET Core HOT 1
- x264 popup appears HOT 1
- Continuous recording, writing out to multiple files HOT 1
- Thumbnail Time Trouble..
- How to record audio microphone and speaker HOT 1
- how to close the video at the end of the process HOT 1
- Different resolutions crop in video
- Issue with example HOT 1
- Please turn MAX_SUPER_INDEX_ENTRIES into an optional parameter HOT 3
- Mpeg4VideoEncoderVcm.GetAvailableCodecs returns an empty array HOT 3
- AviWriter does not close file HOT 3
- Trouble with x264vfw HOT 2
- AVI Wrapped to the right slightly HOT 9
- Errors in Mpeg4VcmVideoEncoder Issues HOT 5
- OverflowException in AviWriter.WriteFileHeader HOT 2
- When using any codec only first frame is visible on the recorded AVI HOT 2
- Resulting Video Playback Problems using VLC
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 sharpavi.