c++ creating 1 video from multiple video files [closed] - c++

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I need to write a program that is a television like.
I will need to create 1 video form
e.g. 4 video files (lets say first video should be in top-left corner, second in top-right corner of the stream, etc.).
Also I'll need to add some scrolling text to the video and so on and so on...
So, the question is,
if there are any libs that could help me with that?
Thank you.

You question missed many details. Do you write cross-platform program? Or should it work on Windows or *nix only? Also do you have unlimited budget for possible libraries? Or are you looking for open source libraries? So...
From common sense you could use FFMPEG library which is crossplatform. If you can use Windows platform than you could use Avisynth, it provides really powerful scripting mechanism that allows you to combine multiple videos into one and you could add your own filters that add watermark or other kind of effects

Not sure about libraries, and you also haven't mentioned the format of the video input files (I'll presume they are in a compressed format like H.264 since if they are raw that is just a subset), but I would need to do shis on Windows, I'd do the following:
1) Read and decoded the frames from the input files (either with FFMPEG or VFW) an then put the encoded data in a larger bitmap with the resulting size of the 4 screens
2) Since now it is a raw bitmap apply the text or whatever is needed using e.g. DrawText(http://msdn.microsoft.com/en-us/library/windows/desktop/dd162498(v=vs.85).aspx), to ease the use of WinAPI you could use some GDI wrapper library.
I guess one of the main pitfalls here is to properly synchronize the presentation times of the frames from different files, since they can all have different fps and time breaks so you can't just read frame by frame but you need to keep track which frame from which file is supposed to be presented at each step when applying the transformations you need.

Related

How do I make PlaySound load only some parts of the song C++ [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 2 years ago.
Improve this question
I have a 424 mb wav file, which I want to play, but it takes a lot of time to load, and it uses 425.6 mb of ram. Way too much ram for a dos format program. I want to load only a part of the song, then when it's almost at the final, load the second part, when the second part is played, remove from ram the first part, and etc. For this I should use 50 parts.
Here is the line of code:
PlaySound("../music/main.wav", NULL, SND_FILENAME|SND_LOOP|SND_ASYNC);
I mention that I need to run this in background, while the other commands do their roles.
PlaySound is a fairly high-level function, so it's tricky to get behavior like this. In particular, you will likely experience small silent gaps between playing back the different parts. So the best solution would be to go to a lower-level API that allows more sophisticated managing of sound playback buffers. OpenAL is a good library for doing this, the modern Windows native solution is WASAPI, which unfortunately is quite complicated to use.
With PlaySound itself, first adjust your program to load the .wav file to memory and then use SND_MEMORY for playing it from memory (example).
Now, instead of loading the whole .wav file at once, you just load the header and as many soundframes as fill your buffer. You then create your own .wav header for just those loaded samples and put it all in a contiguous buffer. You basically build your own, smaller .wav file in memory. Then you call PlaySound(..., SND_MEMORY) on that buffer. Rinse and repeat for the remaining samples from the original file.
Note that you will need your own .wav file format parser for this, but the file format is not that complicated, so hopefully this should not be too much of an issue.

Can't use YouTube-dl to download specified bitrate [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
After needing something both easy and powerful that would allow me to download YouTube playlists and finding no better alternative, I've recently started using youtube-dl (with ffmpeg) in the command line. I'm currently in the process of playing around with and testing the quality of my downloaded playlists, but I've run into a problem converting a playlist to M4A audio at 192kbps. Here is what I'm using:
youtube-dl --extract-audio --audio-format m4a --audio-quality 192 --playlist-items 1-26 https://www.youtube.com/playlist?list=PLR3nWwHlZ9WBpi3uWsjSe6r1PiA8MTbnE
The --audio-quality 192 doesn't seem to be registering, even though the syntax seems right as far as I can tell, and when the audio files are downloaded and extracted, they consist of a whole range of different bitrates, from 189 to 254. Can anyone tell me why I might be having this problem?
According to the youtube-dl helpfile, for bitrate, you need to specify the K after 192. Otherwise it treats it as variable bit rate:
-audio-quality QUALITY Specify ffmpeg/avconv audio quality,
insert
a value between 0 (better) and 9 (worse)
for VBR or a specific bitrate like 128K
(default 5)
See: Post Processing Options in helpfile
UPDATE BASED ON COMMENT: There are open issues suggesting that ffmpeg does not report all the errors it faces when processing, particularly the mp4 (m4a) codec. See Issue 8230. An alternative format may be a workaround. Another workaround may be changing the system's mp4 codecs such that ffmpeg is happier with them.
If neither of these workarounds work for you, please post the output of running the command with the --verbose option so that we can see the debug info.
UPDATED SINCE DOESN'T AFFECT MP3s:
Since ffmpeg is known to have some mp4 codec issues, another thing you can try is use avconv and avprobe instead of ffmpeg and ffprobe as post-processors for youtube-dl. You can download the latest Windows binaries here: LibAV Windows binaries. Don't forget to add the executables to your PATH system environment variable so that youtube-dl can find them.
Then add the --prefer-avconv option in your youtube-dl command and see if it behaves better.
EDIT WITH KNOWN-BUG DETAILS:
It seems you may have tripped over a previously-missed version of this bug M4a Audio file post-processing skipped - While the developer has addressed the slightly different case in the bug description, it seems to occur in your case as well. It may be worth posting the details to the youtube-dl Github Issue Tracker.
Switching to a different format (like mp3) may be the only workaround at this point.

Opening MP3 files with text editors [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 4 years ago.
Improve this question
I have a question:
When I open an mp3 file with a text editor(sublime text), a few hundred thousand numbers in 4 digits appear(like picture below).
I got curious and experimented, deleting sections of the file and playing the mp3 file.
When I deleted the first parts, the music played but the file's CD artwork disappeared. When I deleted a huge chunk of the middle section, the music played but was shortened, with the middle part of the song gone.
Do you know what each part of the picture-letter combination represents?
I want to manipulate mp3 files(slow them down, lower the pitch, etc.) with python by modifying these numbers.
Do you have any insight on this, or what I can google to further explore?
Thanks!
This are hex values and represents how the bytes in you mp3 are laid out in memory. To manipulate them you can think of some ideas of your own for example if you just want to slow the mp3 down you can just copy each hex value and repeat them adjacent to each other. This will result in program reading the same value for a longer time and thus slowing down the tempo. The more copies you make the slower the music will play. Making the music fast requires deleting alternate bytes. Likewise you can think of more ways to manipulate these hex values. For example you can add echo, cancel noise in an audio however I don't know how that's done.
I would suggest looking at an MP3 file structure specification. Each MP3 file is composed of multiple frames and tags. Those hex values you are looking at hold the content for each frame. Modifying each frame will allow you to adjust the sampling rate and bitrate.
For more in-depth information on the MP3 specification, I would take a look at
http://www.multiweb.cz/twoinches/mp3inside.htm

How to extract plain text from MS word document file in pure C++? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 2 years ago.
Improve this question
Is there any pure C++ library to extract plain text from a .doc file?
I'm developing a C++ program to read .doc and .pdf files. I have to extract plain text from the file and write it into a .txt file.
You could have a look at the open source C library used by Abiword, wv.
You can also call out to a batch convert tool
Open source batch converter, based on OpenOffice: http://dag.wieers.com/home-made/unoconv/
The open source for unix: http://www.wagner.pp.ru/~vitus/software/catdoc/
Proprietary for windows: http://doc2txt.com/. Note I havn't tried this one.
If you want to manipulate/read .doc files, you can just take the time and learn the format and manipulate the .doc file manually. You can get it at the MSDN page linking to the format-specification (PDF file).
I admit, it's quite a bit of reading to do, but if you're looking to create software to manipulate/read files, you should have the relevant underlying knowledge to back it all up.
Same goes for the pdf format (which is an open format, and as such specifications should be easy to find).
For doc - Use the Word object model to get to the the document and extract the text. This example uses OLE Automation and C . Another link for DOCX that might help you.
For PDF - Use Haru .
You could always use OIVT (OutsideIn Viewer Technology, I think) now owned by oracle.
I'll be honest, it's not a cheap solution, and while this product is to allow you view, print, etc... I think if i remember correctly, they do offer an option to extract the content to text or they another product that does that. it can do this from pretty much any document type including doc, docx, pdf (just to name a few) without having to use the "original" application installed as they have their own set of filters.
Here's a link to get you started
Outside In Viewer Technolog
Good luck

Library for cross-platform mapping of MIME types to file extensions and vice versa [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
TL;DR: The question is:
Do you know of a cross-platform library that I can use from C++ to map MIME type(s) <-> file extension(s)?
My application is supposed to handle image and video files alike. I try to be as platform agnostic as possible, so I chose to use Qt4 as my main library. The Phonon framework (for handling video files) and QImage (for handling images, obviously) can both report which file formats they support. Phonon will return a list of MIME types that is supported by the installed backend and QImage expresses the supported file formats with a list of file extensions.
The application should find out from a QString fileName whether to create a VideoObject or an ImageObject from it. My approach is to create a map<QString, FuncPtr> that returns the appropriate factory method for creating the correct object. For the string I currently use the file extension, because it is very easy to infer the file extension from the file name. But now I do not have an elegant way to register the supported video file types, since I only know their MIME type.
If I used the MIME types for the key in my map<QString, FuncPtr>, I would be faced with the problem how to
a) map the file name to a MIME type (no clue how to do that platform independently and extensibly)
b) map the file extensions provided by QImage to MIME types
I know that, according to my research up to now, many people suggest to use the "Apache mime.types file", which will preclude me from supporting new file formats (WebM, WebP, ...) when the client updates the back ends.
Other suggestions that I have found is to scan "/etc/mime.types" on Linux (I could do that) or to "query the registry" on Windows (no clue how to do that). But this seems very limited to those two platforms, what about Mac OS X, etc.
In addition to the above stated question I also welcome other suggestions in any shape or form. Perhaps I am missing something brain dead obvious.
Like you already wrote on your question, I'd go for a mimefile from Apache or some Linux distribution and ship it with your application.
Personally I think there is no point in having a "library" for that to "stay permanently up-to-date".
MIME grew huge over the past years, but in reality you just need 1% or less of all defined MIME types in there. People don't have all sorts of file formats on their
If you want to browse some, IANA lists most of the popular MIME types.
TL;DR: Ship your application with a mostly complete mimefile from Apache or some Linux distribution and don't worry about reading it "live" from all target systems.