• Added -pix_fmt output video option to ensure that concatenated segments have the same pixel format (especially for motion JPEG segments generated from still images).
• Also added “file not found” exception handling to FrameSegment.delete_temp_files().
• Deleted obsolete read_segments_from_file().
1 parent b6b915c commit 8d6dad85ba2ce83cea038e0a850e35ba189d93c6
Nigel Stanger authored on 15 Aug 2016
Showing 1 changed file
View
23
process_podcast.py
super(FFmpegConcatCommand, self).__init__(input_opts, output_opts)
self.prepend_output_options(["-codec:a", "pcm_s16le",
"-ac", "1",
"-codec:v", "h264",
"-pix_fmt", "yuv420p",
"-map", "[vconc]",
"-map", "[anorm]"])
self.filters = []
return ""
def delete_temp_files(self):
"""Delete the temporary file(s) associated with the scene."""
# Note: sometimes segments (especially frame segments) may
# share the same temporary file. Just ignore the file not
# found exception that occurs in these cases.
if (self.input_file):
os.remove(self.input_file)
try:
os.remove(self.input_file)
except OSError as e:
if (e.errno != errno.ENOENT):
raise e
super(FrameSegment, self).delete_temp_files()
 
 
def parse_command_line():
file])
ss, ms = command.get_output().strip().split(".")
ms = ms[:3].ljust(3, "0")
return datetime.timedelta(seconds=int(ss), milliseconds=int(ms))
 
 
def read_segments_from_file(segments_file):
"""Read a list of segment punch-in, punch-out point from a file."""
segments = []
with open(segments_file) as f:
for line in f:
segments.append(dict(zip(["in", "out"], line.split())))
return segments
 
 
def make_new_segment(type, filename, punch_in, punch_out, num):
"""Make a new segment instance of the correct class."""