Skip to content

Commit 94e0d4b

Browse files
committed
Merge filter graphs when processing video
1 parent 2de9d67 commit 94e0d4b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

mediacrush/processing/processors.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,17 @@ class VideoProcessor(Processor):
1515
def sync(self):
1616
self._execute(copy)
1717
map_string = ''
18-
filter_string = ''
18+
filter_string = 'scale=trunc(in_w/2)*2:trunc(in_h/2)*2'
1919
if self.processor_state['has_video']:
2020
self._execute("ffmpeg -y -i {0} -vframes 1 -map 0:v:0 {1}.jpg")
2121
map_string += ' -map 0:v:0'
2222
if self.processor_state['has_audio']:
2323
map_string += ' -map 0:a:0'
2424
if 'interlaced' in self.processor_state:
2525
print("WARNING: Detected interlacing on " + self.output)
26-
filter_string += ' -vf yadif'
27-
self._execute("ffmpeg -y -i {0} -vcodec libx264 -acodec libfdk_aac -pix_fmt yuv420p -profile:v baseline -preset slower -crf 18 -vf scale=trunc(in_w/2)*2:trunc(in_h/2)*2" + filter_string + map_string + " {1}.mp4")
28-
self._execute("ffmpeg -y -i {0} -c:v libvpx -c:a libvorbis -pix_fmt yuv420p -quality good -b:v 2M -crf 5" + filter_string + map_string + " {1}.webm")
26+
filter_string = 'yadif,' + filter_string
27+
self._execute("ffmpeg -y -i {0} -vcodec libx264 -acodec libfdk_aac -pix_fmt yuv420p -profile:v baseline -preset slower -crf 18 -vf " + filter_string + map_string + " {1}.mp4")
28+
self._execute("ffmpeg -y -i {0} -c:v libvpx -c:a libvorbis -pix_fmt yuv420p -quality good -b:v 2M -crf 5 -vf " + filter_string + map_string + " {1}.webm")
2929
# Extract extra streams if present
3030
fonts = []
3131
extract_fonts = False

0 commit comments

Comments
 (0)