AV Converter - A video and audio conversion tool By: Mads Moeller CS491B, fall 2006 California State University, Los Angeles Contents 1. Introduction 3 2. Technological Background 4 2.1 Visual C# 4 2.2 FFmpeg 4 2.3 MediaInfo 4 3. System Overview 5 4. Design & Implementation 6 4.1 GUI Design 6 4.2 Implementation 7 5. Performance Evaluation 8 6. Conclusion 8 References 9 2 Abstract: With the explosion in online video sharing and viewing, the Internet has proven to fast become a competitive media towards traditional media corporations as the preferred media, for people to view TV shows, download movies, and view other video content. The days of a physical media is soon to be something of the past. To assist non-technical and novice users, this project will attempt to solve this gap with providing a useful tool in converting video content and making it available online or to maintain a video library. 1. Introduction The purpose of this project is to develop and implement a software program that can be used by the novice computer user to convert video and audio between various formats. Furthermore the program should be able to fulfill usage of more advanced users, such as web designers, video enthusiasts, and others with an aspiration to maintain a personal video library or publish video content online. One of the classes we have enjoyed the most at CSULA has been CS451, which is emphasizing on video and audio encoding/decoding. I find the subject of video and audio very challenging and interesting, and the possibilities in this field seem to have been increasing exponentially within the last few years. Some of the most popular websites as of writing e.g. YouTube, Google Video, are in existence only because the possibility of watching video content online without worrying about having the correct video decoder software and codecs installed. The hassles are very minimal; due to the one of a kind video formats used. For the novice user it can be a jungle to choose which format to choose. There are virtually hundreds of available formats to choose from and multiple video decoder software’s are often needed to watch different videos. Many of these players are often bloated programs that install loads of unnecessary tools, or worse ad- and spy ware. One of the main objectives with the project is to make video conversation fairly easy for novice computer users, without having to know cryptic command line parameters and other non-straight forward procedures. AV Converter will assure the desired output format is possible prior to letting FFmpeg do the conversion to avoid corrupt video/audio files, by guiding the user through the conversion setup. The application will have several options to modify the final output file to accommodate the selective user. Furthermore 3 default settings and other pre-programmed settings will be implemented for the casual user, who doesn’t have a robust knowledge of video coding. 2. Technological Background 2.1 Visual C# .NET 2.0 The software will be developed using Microsoft’s Visual C# language. Visual C# has been chosen due to it’s similarity to the Java language, but much smoother development tools to possibility to create more attractive GUIs. Unlike Java’s often clunky GUI’s, Visual C# allow the user to experience a much more familiar and smooth user interface like commercial Windows software products. Visual C# is a part of Microsoft’s .NET framework, and the language itself is very similar to standard Java. The .NET framework is similar to and can be compared to Java’s JVM. 2.2 FFmpeg v.7166 Another vital part for the project is the open source project called FFmpeg, which is an essential back-end for the program. FFmpeg is an audio/video codec library. FFmpeg originally comes from the Linux platform, and due to it’s written in ANSI C, it’s a rather easy task to compile the library for use on the Windows platform as well. It’s a sturdy and well tested piece of software and is the chosen library by many others when it comes to converting video content. This project, AV Converter, will act as the front-end application that will communicate with FFmpeg via command line calls. This way was chosen because there currently isn’t a wrapper class available to make API calls from the C# language. Since creating a wrapper class is outside the scope of this project, the possibility to pass command line parameters to FFmpeg was chosen. FFmpeg was compiled from the source code by using instructions provided by Sönke Rohde (see references). 2.3 MediaInfo v0.7.1.0 To retrieve detailed file information of the files to be converted another open source program was chosen to assist. A bit of research showed that the tool MediaInfo was an excellent candidate. The tool can read all major information of interest from a video/audio file such as file 4 type, file size, length of video, audio/video bit rate, aspect ratio, etc. This is all very useful information to prepare the video conversion. By having this information available it’s easy to convert the video from one format to another and keeping the output file quality close to the original, if this is desired. 3. System Overview The program is built upon the below elements. The “AV Converter Front-end” is purely programmed in C# and “FFmpeg” and “MediaInfo are back-end modules. AV Converter Front-end FFmpeg MediaInfo When a file is loaded into AV Converter a call is made to MediaInfo to retrieve all information of the file that is to be converted. MediaInfo will return the information to the frontend, and the information will be parsed and passed into the main window form for viewing. After the user has selected the format of the output video, parameters are compiled and passed to FFmpeg. This is done by making thread, which creates a new process so FFmpeg can run in the background. Upon completion, a message is sent back to the main window that the conversion is done as the program is available again. 5 4. Design & Implementation 4.1 GUI design As mentioned earlier an important aspect of the project is to make the user interface easy to approach. With great help by the GUI designer in Visual Studio .NET 2005, the design aspect became straight forward. It was decided to avoid cryptic terminology and complicated steps to convert to avoid confusing the user. With this in mind the ability to add an advanced feature for both video and audio was added. This allows the more advanced user to experience various decisions in how they want the final output to be. The figure above show the main window of AV Converter which the user is presented with when the application is loaded. The user interface is divided into 3 main sections, Video Output, Audio Output, and Input File Info. The first group box “Video Output”, the user will select the desired output video format. The current version of the program allows conversion from QuickTime, MPEG1/2, and Windows Media Video, AVI (DivX, XviD) to Windows Media Video, MPEG1/2, QuckTime, DivX, and Flash Video. The “Advanced” button under “Video Output” allow the user to modify the bit rate, frame rate, frame 6 size, aspect ratio, and if the video should be deinterlaced. Furthermore the user can crop and pad the output file measured in pixels. Under the settings menu there are several pre-programmed output options that can be useful if the user knows what media the output file will be used in e.g. DVD, iPOD or ReplayTV. When the user uses the pre-defined options, both video and audio are determined by the profile. The second group box “Audio Output” the user has the ability to select the audio codec of their choice to use in the output file. By default this is set to mp3 at 128KBps unless the “No Audio” option is selected. The “Advanced” button allows the user to select an audio bit rate, sampling frequency, and stereo or mono. Both the bit rate and sampling frequency consist of drop-down boxes with common values. The reason for making this is it’s very unlikely any user would user other values than these common values. The last group box “Input File Info” displays useful information regarding the input file, which can be very useful for the selective video converter. The File menu allows the user to exit the program and select a file for conversion in the same way the browse button allows it. The Settings menu contains the options to load pre-defined profiles and save new profiles. This will be covered in more details in the next section. 4.2 Implementation After the user has selected his options for the conversion, all parameters for the video and audio conversion are retrieved from their designated variables. A string is compiled and passed to FFmpeg for the conversion to begin. If the user created his own parameters under the advanced option, he can decide to save this profile, so he can reuse the same parameters on a different file. In the Settings menu the user can select “Save Current”, which prompts him to enter a profile name. The profile name, file type and output parameters are saved into an XML file. The content of the XML file is loaded into an ArrayList, where the profile name is the Key and the parameters are in the Value field. This allows the program to make sure that you cannot use the same name for different profiles. When a new profile is added the main form is reloaded, so any new profiles are available immediately. By saving profiles allows the user to always have access to his favorite profiles. 7 The XML file is also loaded upon startup of the program. To get the input file information, the program, as mentioned earlier, makes a call to MediaInfo. MediaInfo sends the information to a temporary file. The temporary file is opened and all needed information is matched and sent to the main form in AV Converter for the user to review. The only purpose of MediaInfo is to retrieve this information. 5. Performance Evaluation The performance of the program lives up what can be expected, since all conversion is performed by the FFmpeg library. The program was tested on various computers such as an Intel Core2 Duo 2.4GHz and an Intel Centrino 1.73GHz. Both computers were running Windows XP. As expected the more processor power, the faster the conversion is. 6. Conclusion The original intention of the program was to provide a useful tool to the newbie video converter, and to fulfill fundamental needs for the more advanced users as well. This goal has definitely been met, and this has given us further inspiration to continue development of the program. We feel we succeeded in making the program both intuitive and user-friendly, and the procedure in converting a video/audio file look like a fairly easy task. Furthermore we feel we chose the right language for the project although we weren’t able to make API calls directly to the FFmpeg library. The project has given us a good insight in the world of video and audio formats, which we didn’t know prior to taking on the task of creating this product. A big lesson learned is the importance of having a fairly refined project on-hand prior to entering CS491B. This was a lacking problem with this project, since the project was started from scratch at the beginning of the term. Based on these circumstances, we do feel the outcome became a decent refined project. Some of the future expansion we would like to implement in the program would be conversion to more video formats and the possibility to burn the video files directly from the program to DVD, SVCD, or VCD. 8 References http://ffmpeg.mplayerhq.hu http://mediainfo.sourceforge.net http://soenkerohde.com/tutorials/ffmpeg/ 9
© Copyright 2026 Paperzz