Overview
Welcome to the TS2MP4 documentation page. Here you will find comprehensive information on the TS2MP4 library, including its features, installation instructions, usage guide, and code examples.
Features
- Convert TS (Transport Stream) video files to MP4 format
- High-quality conversion with minimal loss of video or audio quality
- Support for both MPEG-2 and H.264 encoded TS files
- Conversion of multiple TS files in batch mode
- Customizable output settings, including resolution, bitrate, and framerate
- Seamless integration with popular programming languages such as Objective-C, Swift, and others
- Compatible with iOS and macOS platforms
Installation
TS2MP4 can be easily installed using Cocoapods, a popular dependency manager for iOS and macOS projects.
Step 1: Open your terminal and navigate to your project’s root directory.
Step 2: Run the following command to install Cocoapods if you haven’t already:
sudo gem install cocoapods
Step 3: Create a file named ‘Podfile’ in your project’s root directory.
Step 4: Open the ‘Podfile’ and add the following line:
pod 'TS2MP4'
Step 5: Save the ‘Podfile’ and run the following command in your terminal:
pod install
Step 6: Close your Xcode project and open the newly created ‘.xcworkspace’ file.
Usage Guide
To convert TS video files to MP4 format using TS2MP4, follow these steps:
- Import the TS2MP4 framework into your project.
- Import the necessary TS2MP4 classes into your code file.
- Create an instance of the TS2MP4Converter class.
- Specify the input TS file path and the desired output MP4 file path.
- Optionally, customize the output settings using the available properties and methods.
- Call the `convert` method of the TS2MP4Converter instance to start the conversion.
Code Examples
Here are some code examples demonstrating the usage of TS2MP4:
// Import TS2MP4 framework
import TS2MP4
// Create TS2MP4Converter instance
let converter = TS2MP4Converter()
// Set input and output file paths
converter.inputFilePath = "/path/to/input.ts"
converter.outputFilePath = "/path/to/output.mp4"
// Customize output settings (optional)
converter.resolution = CGSize(width: 1280, height: 720)
converter.bitrate = 5000
// Start the conversion process
converter.convert { success, error in
if success {
print("Conversion successful!")
} else if let error = error {
print("Conversion failed with error: \(error.localizedDescription)")
}
}
Conclusion
Congratulations! You have successfully learned about TS2MP4 and its capabilities. With this library, you can easily convert TS video files to MP4 format with high quality and minimal effort. Happy coding!