How to create an avi file from scratch? [closed] - c++

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
My task is to create an avi file by saving n number of frames in c++ .
There are many inbuilt function which can be used to create .avi file as given in below link .
https://learn.microsoft.com/en-us/windows/desktop/multimedia/avifile-reference
Using them we can create our own avifile , one such example.is
http://www.wischik.com/lu/programmer/avi_utils.html
But i want to create it without using Windows.h and vfw.h as they are very extensive.
So i need to make my own function of avifilewrite , appendframes etc
But i can't find any reference link on internet .
Can anyone please explain how can i build avifile without using Windows.h and vfw.h .
Thank you ,

How to create an ... file ...?
You can use the standard file stream API to create a file. To write a binary file, you'll need to use an unformatted output function such as std::ofstream::write().
... an avi file from scratch?
The AVI format is specified by Microsoft: https://learn.microsoft.com/en-us/windows/desktop/directshow/avi-riff-file-reference
However, you can save a lot of effort by using an existing API.

Related

Statistica VB - Including an external macro [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I'm using Statistica 64 VB. I wrote a function "Public MyFunction()" in FileLibrary.svb (a collection of useful functions) that I want to be called by a function in FileDoStuff.svb (an analysis).
I tried to include FileLibrary.svb like this in FileDoStuff.svb:
'#Language "WWB-COM"
'#Uses "U:\TestSVB\FileLibrary.svb"
This is the result when I run Main() in FileDoStuff, and the result is the same even if I have FileLibrary open in the application.
"Script error in FileDoStuff.svb
Macro/module does not exist."
Statistica is on the E: drive. However, FileLibrary opens a spreadsheet on U: and has no problem with it. I am able to open FileLibrary from Statistica and test it.
Why would it work to open an external spreadsheet but not call an external macro? The FileLibrary is not saved within Statistica, but neither is the analysis in FileDoStuff. What am I doing wrong?
Also, what's the difference between an SVB and an SVX file?
You know what really helps, as I discovered after hours of trying everything?
Try spelling the entire path name and the entire file name correctly, including spaces, etc. And make sure the slashes go the right way, too. (In my real path/file there are spaces.)
As much as I'd like to delete this whole question, I'm leaving it here to remind us all that sometimes the answer is just that simple. Also, I want to draw more people out who are using Statistica VB because I know there will be more questions.

How do I open and display a file with any file extension in C++? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
I'm doing a program where I have to read information from a file and it can be a file with any extension. Do you know any way in C++ to read and display the information from a file different than the .txt extension?
There is actually no real difference that would be made by a file extension, so you can - in theory - open any file you want, for example by using std::ifstream. However, files that are not using a human-readable encoding (like txt/json/... files), you propably want to open it in binary mode (you can specify this to std::ifstream).
However, if you actually want some usefull information of some specific, not human readable file (like for example the dimensions of a images saved as a png file), you need way more detailled code. To read, for example, information from an png file, you have to open it in binary mode using std::ifstream, and then interpret the read bytes yourself to get any usefull information out of it. So you actually have to know how the specific file format you want to read is encoded, and need to have (or to implement yourself) a decoder for that specific file format.

How can I analyze file and detect if the file is in H.264 video format? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I write software C/C++ to recover deleted files, and I need to identify files according to their binary content, so my question is there a simple way to know if a particular file is H.264 format video? is H.264 has an signature?
I saw the code of FFMPEG here, but can it help me, how?
For those who encounter this question but are looking for a cli solution you can use ffprobe:
ffprobe -loglevel error -select_streams v -show_entries stream=codec_name -of default=nw=1:nk=1 input.mkv
Outputs:
h264
The problem is that H.264 is not a file format, it is a video compression standard, and as such it can be found in multiple file formats. You can have a .f4v encoded with H.264 as much as you can have .mp4 with H.264.
So, how do you solve your issue? Well, I strongly advise you to use a library that does that for you. libavformat, for example, should do the trick (check the AVStream and AVFormatContext structures, and the avformat_open_input function).
Now, if you absolutely want to do it without libraries, you can check out the documentation for each video container format that supports H.264 to see how to retrieve the encoding information of the video stream, but expect this to take you at least a month or two.
If you want to use FFmpeg - avformat_find_stream_info() should help you. An there is an example.

Writing data from buffer to wave file on disk [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'm writing a program which play wave file using waveOutOpen and PlaySound. Now I must write a function to record voice from microphone in Wave file on disk. I use writeInOpen and waveInAddBuffer to record sound in buffer but i can't find an easy class to manipulate on wave file and copy buffer content to file .wav. Thanks for suggestions!
You have to create the file yourself.
You can use the Multimedia File I/O API, specifically at mmioOpen(), mmioCreateChunk(), mmioAscend(), and mmioWrite() functions. You need a good understanding of how the WAVE file format works, how the WAVEFORMAT/EX structures work, etc so you know which pieces to write and how to write them correctly.
Or use DirectX's DirectSound API, specifically the IDirectSoundCaptureBuffer8 interface and the CWaveFile helper class:
Writing to a WAV file
Until you have an understanding of either approach, you should consider using an existing library to do the hard work for you, for example:
Wave Class for Playing and Recording Wave Files

How to increase portability of 7z.exe [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I am working on a program that needs to unzip .zip files. After trying several different methods to do this, the only one I could find that worked for all my needs is 7z.exe. It works great as I'm developing since I can just hardcode the location of the executable into the code. However, if anyone else tries to use it, that part won't work. Is there any way to allow them to access this? Thanks!
I suggest you use a compression library (have a look at libarchive: http://www.libarchive.org). If you can't do that, you should ship 7z.exe and its dependencies with your application, putting them in a fixed relative location to your main executable.
Then you get your main executable absolute path using GetModuleFileName, strip and combine with the relative path using PathCchCombine:
char filename[MAX_PATH];
GetModuleFileName(NULL,filename,(sizeof(filename))/(sizeof char));
PathCchRemoveFileSpec(filename,(sizeof(filename))/(sizeof char));
PathCchCombine(filename,(sizeof(filename))/(sizeof char),filename,"./7zip/7zip.exe");
//the absolute path of 7z.exe is now in filename
Documentation for GetModuleFileName:
http://msdn.microsoft.com/en-us/library/windows/desktop/ms683197(v=vs.85).aspx
PathCchRemoveFileSpec:
http://msdn.microsoft.com/en-us/library/hh707092(v=vs.85).aspx
and for PathCchCombine:
http://msdn.microsoft.com/en-us/library/hh707085(v=vs.85).aspx