Features:
I've just spent the last few hours figuring this out, please enjoy
- Batch conversion (with prompts) from any format to avi (XVID)
- Easy edit for making any changes (1 extra line of code, and you can choose a different format to convert to etc.)
- Public Domain license (have fun!)
How to use:
- Install a compiler (recommend: g++, or for an IDE [with g++ backend]: CodeBlocks)
- Compile this code:
If you would like other features (e.g. Linux support) please request below.Code:#include <iostream> #include <fstream> #include <vector> #include <windows.h> using namespace std; vector<string> directoryContents(string, string); int main() { string directory, filetype; int show=0; cout << "Enter directory [C:\]: ", cin >> directory; cout << "Enter filetype [ogv]: ", cin >> filetype; cout << "Show FFmpeg? [5 for yes]: ", cin >> show; if(show!=5) show=0; vector<string> dirContent = directoryContents(directory, filetype); cout << dirContent.size() << " files to be transcoded"; for(float i=0; i<dirContent.size(); i++) { string file = "-i "+directory+'\\'+dirContent[i]+" -vcodec libxvid -b 7360 -y " +directory+'\\'+dirContent[i]+".avi"; cout << "Transcoding [" << dirContent[i] << "] file" << i << " of " << dirContent.size(); ShellExecute(NULL, TEXT("open"), TEXT("ffmpeg"), TEXT(file.c_str()), NULL, show); cout << "\n\nPercent complete: " << (i/dirContent.size())*100 << "%\n"; } cout << "\n\nPercent complete: " << 100 << "%\n"; } vector<string> directoryContents(string fileName, string fileType) { WIN32_FIND_DATA FindData; fileName += "\\*."+fileType; HANDLE Result = FindFirstFile(fileName.c_str(), &FindData); vector<string> TextFiles; DWORD ErrorValue; for(BOOL BOOLResult; !ErrorValue; BOOLResult = FindNextFile(Result, &FindData)) if(BOOLResult) TextFiles.push_back(string(FindData.cFileName)); else ErrorValue = GetLastError(); return TextFiles; }
Thank me if you like this post!
Cheers,
Alec Taylor
NOTE: If this little C++ script becomes popular, I'll include an installer+precompiled binary. Request one if you want it earlier![]()
+ Reply to Thread
Results 1 to 1 of 1
Similar Threads
-
Can I get a little help with an ffmpeg script/batch file?
By Iced Coffee in forum Newbie / General discussionsReplies: 14Last Post: 26th Aug 2015, 01:56 -
Need help with ffmpeg batch file
By DarrellS in forum Video ConversionReplies: 3Last Post: 25th Jun 2012, 15:43 -
BatchShrink, a batch wrapper for DVD Shrink 3.2
By midders in forum DVD RippingReplies: 22Last Post: 12th Feb 2012, 02:12 -
How to batch converting from winamp playlist the maximum of formats to m2ts
By Comancheace in forum Video ConversionReplies: 1Last Post: 13th Jul 2010, 13:38 -
Batch Converting of Varouous vide fromats to Flash flv with ffmpeg
By tempgp in forum ProgrammingReplies: 0Last Post: 7th Dec 2007, 15:58