Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
Map only video and audio streams
Browse files Browse the repository at this point in the history
  • Loading branch information
kelciour committed Oct 10, 2020
1 parent 93fe7d3 commit b8326b9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions playphrase.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def create_fragments(search_phrase, clips, export_mode, output_dir):
subprocess_call(cmd)

if export_mode["video"]:
cmd = ["ffmpeg", "-y", "-ss", str(ss), "-i", video_file, "-strict", "-2", "-t", str(t), "-map", "0", "-c:v", "libx264", "-preset", video_encoding_mode, "-c:a", "aac", "-ac", "2", "-af", af, fragment_filename + ".mp4"]
cmd = ["ffmpeg", "-y", "-ss", str(ss), "-i", video_file, "-strict", "-2", "-t", str(t), "-map", "0:v", "-map", "0:a", "-c:v", "libx264", "-preset", video_encoding_mode, "-c:a", "aac", "-ac", "2", "-af", af, fragment_filename + ".mp4"]
subprocess_call(cmd)

if export_mode["video-sub"]:
Expand All @@ -212,7 +212,7 @@ def create_fragments(search_phrase, clips, export_mode, output_dir):
vf = "subtitles=" + srt_filename + ":force_style='" + srt_style + "',setpts=PTS-STARTPTS"
af = "afade=t=in:st=%s:d=%s,afade=t=out:st=%s:d=%s,asetpts=PTS-STARTPTS" % (ss, t_fade, to - t_fade, t_fade)

cmd = ["ffmpeg", "-y", "-ss", str(ss), "-i", video_file, "-strict", "-2", "-t", str(t), "-map", "0", "-c:v", "libx264", "-preset", video_encoding_mode, "-c:a", "aac", "-ac", "2", "-vf", vf, "-af", af, "-copyts", fragment_filename + ".sub.mp4"]
cmd = ["ffmpeg", "-y", "-ss", str(ss), "-i", video_file, "-strict", "-2", "-t", str(t), "-map", "0:v", "-map", "0:a", "-c:v", "libx264", "-preset", video_encoding_mode, "-c:a", "aac", "-ac", "2", "-vf", vf, "-af", af, "-copyts", fragment_filename + ".sub.mp4"]
subprocess_call(cmd)

if export_mode["subtitles"]:
Expand Down

0 comments on commit b8326b9

Please # to comment.