def action_inject_delay(self): stereo = None if (self.var_3d.get()): stereo = "top-bottom" xml = spherical.generate_spherical_xml(stereo=stereo) metadata = spherical.Metadata() metadata.video = xml if self.var_spatial_audio.get(): # Default ambisonics audio metadata audio_metadata = {'ambisonic_order': 1, 'ambisonic_type': 'periphonic', 'ambisonic_normalization': 'SN3D', 'ambisonic_channel_ordering': 'ACN', 'channel_map': [0, 1, 2, 3]} metadata.audio = audio_metadata console = Console() spherical.inject_metadata( self.in_file, self.save_file, metadata, console.append) self.set_message("Successfully saved file to %s\n" % ntpath.basename(self.save_file)) self.button_open.configure(state="normal") self.button_quit.configure(state="normal") self.update_state()
def inject(self): """Inject metadata into a new save file.""" self.save_file = tkFileDialog.asksaveasfilename(**self.open_options) if self.save_file: self.set_text("Saved file to: %s\n" % self.save_file) xml = spherical.generate_spherical_xml() spherical.inject_metadata(self.in_file, self.save_file, xml, self.append_text)
def main(): """Main function for printing / injecting spherical metadata.""" parser = OptionParser(usage="%prog [options] [files...]\n\n" "By default prints out spherical metadata from" "specified files.") parser.add_option("-i", "--inject", action="store_true", help="injects spherical metadata into a MP4/WebM file, " "saving the result to a new file") parser.add_option( "-s", "--stereo", type="choice", action="store", dest="stereo", choices=["none", "top-bottom", "left-right"], default="none", help="stereo frame order (top-bottom|left-right)", ) parser.add_option( "-c", "--crop", type="string", action="store", default=None, help=("crop region. Must specify 6 integers in the form " "of \"w:h:f_w:f_h:x:y\" where " "w=CroppedAreaImageWidthPixels " "h=CroppedAreaImageHeightPixels " "f_w=FullPanoWidthPixels " "f_h=FullPanoHeightPixels " "x=CroppedAreaLeftPixels " "y=CroppedAreaTopPixels"), ) (opts, args) = parser.parse_args() if opts.inject: if len(args) != 2: console("Injecting metadata requires both" "a source and destination.") return spherical_xml = generate_spherical_xml(opts.stereo, opts.crop) if spherical_xml: inject_metadata(args[0], args[1], spherical_xml, console) else: print "Failed to generate XML metadata." return if len(args) > 0: for src in args: parse_metadata(src, console) return parser.print_help() return
def main(): """Main function for printing / injecting spherical metadata.""" parser = OptionParser(usage="%prog [options] [files...]\n\n" "By default prints out spherical metadata from" "specified files.") parser.add_option("-i", "--inject", action="store_true", help="injects spherical metadata into a MP4/WebM file, " "saving the result to a new file") parser.add_option("-s", "--stereo", type="choice", action="store", dest="stereo", choices=["none", "top-bottom", "left-right"], default="none", help="stereo frame order (top-bottom|left-right)",) parser.add_option("-c", "--crop", type="string", action="store", default=None, help=("crop region. Must specify 6 integers in the form " "of \"w:h:f_w:f_h:x:y\" where " "w=CroppedAreaImageWidthPixels " "h=CroppedAreaImageHeightPixels " "f_w=FullPanoWidthPixels " "f_h=FullPanoHeightPixels " "x=CroppedAreaLeftPixels " "y=CroppedAreaTopPixels"),) (opts, args) = parser.parse_args() if opts.inject: if len(args) != 2: console("Injecting metadata requires both" "a source and destination.") return spherical_xml = generate_spherical_xml(opts.stereo, opts.crop) if spherical_xml: inject_metadata(args[0], args[1], spherical_xml, console) else: print "Failed to generate XML metadata." return if len(args) > 0: for src in args: parse_metadata(src, console) return parser.print_help() return
def action_inject_delay(self): stereo = None if self.var_3d.get(): stereo = "top-bottom" xml = spherical.generate_spherical_xml(stereo=stereo) console = Console() spherical.inject_metadata(self.in_file, self.save_file, xml, console.append) self.set_message("Successfully saved file to %s\n" % ntpath.basename(self.save_file)) self.button_open.configure(state="normal") self.button_quit.configure(state="normal") self.update_state()
def action_inject_delay(self): stereo = None if (self.var_3d.get()): stereo = "top-bottom" xml = spherical.generate_spherical_xml(stereo=stereo) console = Console() spherical.inject_metadata(self.in_file, self.save_file, xml, console.append) self.set_message("Successfully saved file to %s\n" % ntpath.basename(self.save_file)) self.button_open.configure(state="normal") self.button_quit.configure(state="normal") self.update_state()