simple-video-encoder
a simple H.264 video encoder by PyQt5
requirements:
- python 3.6
- ffmpeg-python
- ffmpeg (see the question in stackoverflow)
- PyQt5
- LAVFilters (see the question in stackoverflow)
run main.py
cd .\video_encoder
python main.py
user guide
- File->Open->select the input video file
MVC pattern in Python
It is my first time to use MVC pattern to write a GUI. tutorial gives a neat mini-example to explain what MVC pattern is.
Download these three .py files and run them can give a clear sense of MVC pattern
A PyQt example of video player
see tutorial
Exceptions handling
I also learn something of exceptions handling in python. Thanks to the contributors in stackoverflow, my problem could be tackled properly. Here is my final solution,
def updateFilename(self):
self.model.updateFilename(self.fileName)
def updateOutput(self):
self.model.updateOutput(self.encodeDialog.output)
def encodeVideo(self):
try:
self.updateFilename()
self.updateOutput()
flag = True
except (type_exc.PathIsEmpty, type_exc.FileAlreadyExists, type_exc.PathNotExists) as e:
flag = False
self.errorDialog.errorTypeChanged(e)
self.errorDialog.exec_()
if flag:
self.model.encodeVideo()