Skip to content

Commit 05d0726

Browse files
committed
2 parents 4d4e1e7 + 215124f commit 05d0726

File tree

1 file changed

+86
-0
lines changed

1 file changed

+86
-0
lines changed

README.md

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# FFmpeg.NET
2+
A .NET Wrapper for FFmpeg
3+
4+
## Features
5+
- Manages processes programatically (start, track, cancel)
6+
- Parses FFmpeg's output to track progress and create a rich user interface
7+
- Provides easy access to common functions, and can be extended to call and track any other console process
8+
- Can also call avs2yuv to pipe an Avisynth stream to FFmpeg, and it will manage processes accordingly
9+
10+
## Classes
11+
1. MediaProcesses *(static)*
12+
- GetFFmpegProcesses
13+
- SoftKill *(allows FFmpeg to finish writing its files when canceling)*
14+
2. MediaInfo *(static)*
15+
- GetFileInfo *(can be used as a replacement for MediaInfo.DLL)*
16+
- GetFrameCount
17+
3. MediaMuxer *(static) provides functions to manage streams losslessly*
18+
- Muxe
19+
- Concatenate
20+
- ExtractVideo
21+
- ExtractAudio
22+
4. MediaEncoder *(static)*
23+
- ConvertToAvi
24+
- Encode
25+
5. FFmpegProcess
26+
- Run
27+
- RunFFmpeg
28+
- RunAvisynthToFFmpeg
29+
- RunAvisynth
30+
- RunAsCommand
31+
- Cancel
32+
- +Many properties and events related to the job, process and video.
33+
34+
## Display Options
35+
1. FFmpegDisplayMode
36+
- None
37+
- Native *(standard console box)*
38+
- Interface *(allows implementing a rich user interface via events)*
39+
- ErrorOnly *(displays console output if an error occurs)*
40+
2. ProcessStartOptions
41+
- DisplayMode *(see above)*
42+
- Title *(when displaying custom interface)*
43+
- Priority *(CPU)*
44+
- JobId *(allows several processes to be routed to the same UI)*
45+
- IsMainTask *(when implementing custom UI, whether to track the output of this process)*
46+
- FrameCount *(if input file doesn't provide frame count, such as when using pipe input, you can provide it here)*
47+
- ResumePos *(set this if you're resuming a job to facilitate the UI)*
48+
- Timeout *(cancels the task after a period)*
49+
- event Started *(allows the caller to grab the FFmpegProcess)*
50+
51+
## How To Use
52+
Before using these classes, you must configure FFmpegConfig.
53+
- FFmpegPath *(default = "ffmpeg.exe")*
54+
- Avs2yuvPath *(default = "avs2yuv.exe")*
55+
- UserInterfaceManager *(create your derived class here to create an UI)*
56+
57+
By default, canceling tasks is done with a soft kill to let FFmpeg close its files in a clean state.
58+
**This implementation, however, won't work for Console Applications.** If you are using this class in a
59+
console application, you must handle FFmpegProcess.CloseProcess event and implement a work-around as
60+
described [here](http://stackoverflow.com/a/29274238/3960200); or simply call Process.Kill if you don't mind a hard kill.
61+
62+
## Cool Usages
63+
64+
1. **Avisynth Pause/Resume.** Encoding videos with Avisynth can take a long time, and crashes may occur, or you may
65+
want to use your computer for something else while it is running. The provided interface makes it easy to run
66+
Avisynth via avs2yuv and pipe the output to FFmpeg. The user can then click "Cancel" to stop the job in a clean state,
67+
and you can count the number of encoded frames, edit the script to start at that position, and resume from there.
68+
Once the whole video has been processed, you can use MediaMuxer.Concatenate to merge all the segments and voilà!
69+
70+
2. **Multi-Tasking.** You may need to run several tasks, some in parallel, some in sequence. For example,
71+
while the video is encoding, you may want to extract the audio to WAV and run OpusEnc or NeroAac to encode the audio in parallel.
72+
Once both the audio and video and done, you then may want to muxe them back together. You can manage that whole process in the
73+
same UI window by first calling FFmpegConfig.UserInterfaceManager.Start with a JobId and calling FFmpegConfig.UserInterfaceManager.End
74+
when done. All processes started with that JobId will be routed to the same UI. Tasks with IsMainTask will be parsed allowing
75+
you to display FFmpeg's progress with a progress bar, while tasks with IsMainTask=false will allow displaying
76+
"Extracting audio", "Encoding Audio" and "Muxing Audio and Video" while those are running in the background. You can also easily
77+
track and cancel the whole chain of commands.
78+
79+
See ExampleApplication to view FFmpeg.NET in action.
80+
81+
## About The Author
82+
83+
[Etienne Charland](https://www.spiritualselftransformation.com), known as the Emergence Guardian, helps starseeds reconnect with their soul power to accomplish the purpose
84+
they came here to do. [You can read his book at Satrimono Publishing.](https://satrimono.com/) Warning: non-geek zone.
85+
86+
You may also be interested in the [Natural Grounding Player, Yin Media Encoder, 432hz Player, Powerliminals Player, and Audio Video Muxer.](https://github.com/mysteryx93/NaturalGroundingPlayer)

0 commit comments

Comments
 (0)