flatpak: auto-detect x264 gstreamer plugin
due to patent and licensing problems x264 gstreamer plugin isn't included in flatpak runtime. Use openh264 encoder is x264 encoder is missing. openh264 takes bitrate in bits per second and x264 takes bitrate in kbits per second.
This commit is contained in:

committed by
Martijn Braam

parent
d851344fc0
commit
c8e0808ea5
11
mpegize.py
11
mpegize.py
@@ -263,6 +263,13 @@ def gst_convert(mega_dir, out_file, use_jpeg):
|
|||||||
movie.start_time = tm
|
movie.start_time = tm
|
||||||
audio.start_time = tm
|
audio.start_time = tm
|
||||||
|
|
||||||
|
def pipeline_264enc():
|
||||||
|
if Gst.Registry.get().find_plugin("x264"):
|
||||||
|
s = "x264enc bitrate=3072 speed-preset=ultrafast"
|
||||||
|
else:
|
||||||
|
s = "openh264enc bitrate=3145728 ! h264parse"
|
||||||
|
return s
|
||||||
|
|
||||||
def pipeline_video():
|
def pipeline_video():
|
||||||
if True:
|
if True:
|
||||||
s = "appsrc name=source"
|
s = "appsrc name=source"
|
||||||
@@ -277,7 +284,7 @@ def gst_convert(mega_dir, out_file, use_jpeg):
|
|||||||
elif True:
|
elif True:
|
||||||
s += " ! videoconvert ! autovideosink"
|
s += " ! videoconvert ! autovideosink"
|
||||||
else:
|
else:
|
||||||
s += " ! videoconvert ! x264enc bitrate=3072 speed-preset=ultrafast ! matroskamux ! filesink location=" + out_file
|
s += " ! videoconvert ! " + pipeline_264enc() + " ! matroskamux ! filesink location=" + out_file
|
||||||
|
|
||||||
pipeline = Gst.parse_launch(s)
|
pipeline = Gst.parse_launch(s)
|
||||||
|
|
||||||
@@ -331,7 +338,7 @@ def gst_convert(mega_dir, out_file, use_jpeg):
|
|||||||
s += "videotestsrc"
|
s += "videotestsrc"
|
||||||
s += " ! video/x-raw,width=(int)640,height=(int)480,format=(string)RGB "
|
s += " ! video/x-raw,width=(int)640,height=(int)480,format=(string)RGB "
|
||||||
|
|
||||||
s += " ! videoconvert ! x264enc bitrate=3072 speed-preset=ultrafast ! matroskamux name=mux"
|
s += " ! videoconvert ! " + pipeline_264enc() + " ! matroskamux name=mux"
|
||||||
if False:
|
if False:
|
||||||
s += " ! decodebin ! playsink"
|
s += " ! decodebin ! playsink"
|
||||||
else:
|
else:
|
||||||
|
Reference in New Issue
Block a user