Generate command for ffmpeg.
432008
function command(os) {
  var z = 'ffmpeg';
  var os = os||[];
  for(var o of os) {
    var o = o||{};
    for(var k in o) {
      if(o[k]==null) continue;
      if(k==='stdio') continue;
      if(k==='o' || k==='outfile') z += ` "${o[k]}"`;
      else if(typeof o[k]==='boolean') z += o[k]? ` -${k}`:'';
      else z += ` -${k} ${JSON.stringify(o[k])}`;
    }
  }
  return z;
}
663184
def create_flac (archive, compression, cmd, verbosity, interactive, filenames):
    """"""
    cmdlist = [cmd, filenames[0], '--best', '--output-name', archive]
    return cmdlist
1299607
def perform_command(self):
        
        if len(self.actual_arguments) < 1:
            return self.print_help()
        audio_file_path = self.actual_arguments[0]

        try:
            audiofile = AudioFile(audio_file_path, rconf=self.rconf, logger=self.logger)
            audiofile.read_properties()
            if self.has_option([u"-f", u"--full"]):
                audiofile.read_samples_from_file()
            self.print_generic(audiofile.__unicode__())
            return self.NO_ERROR_EXIT_CODE
        except OSError:
            self.print_error(u"Cannot read file '%s'" % (audio_file_path))
            self.print_error(u"Make sure the input file path is written/escaped correctly")
        except AudioFileProbeError:
            self.print_error(u"Unable to call the ffprobe executable '%s'" % (self.rconf[RuntimeConfiguration.FFPROBE_PATH]))
            self.print_error(u"Make sure the path to ffprobe is correct")
        except AudioFileUnsupportedFormatError:
            self.print_error(u"Cannot read properties of file '%s'" % (audio_file_path))
            self.print_error(u"Make sure the input file has a format supported by ffprobe")

        return self.ERROR_EXIT_CODE
316779
function VideoConverter(options) {

    var _this = this;

    this.name = function() {
        return options.name;
    };

    this.extName = function () {
        return options.ext;
    };

    /**
     * Generate a stream from the video converter
     * @param size
     * @returns {*}
     */
    this.toStream = function (size) {
        var factory = ps.factory(false, !options.streamEncoding, function (input, output, callback) {
            var stream = this;
            var ffm = _this.convert(input, size, output, callback);
            ['start','progress','error'].forEach(function(event) {
                ffm.on(event, function() {
                    stream.emit.apply(stream,[event].concat(arguments));
                });
            });
        });
        factory.videoConverter = this;
        return factory;
    };

    this.convert = function (input, size, output, callback) {
        var ffm = ffmpeg(input).outputOptions(options.args);
        ffm.on('start', function(commandLine) {
            console.log('Spawned Ffmpeg with command: ' + commandLine);
        });
        if (size) {
            var match = size.match(/(\d+)x(\d+)/);
            if (match) {
                ffm.addOutputOptions("-vf", scale(match[1], match[2]));
            } else {
                throw new Error("Illegal size specification: "+size);
            }
        }
        ffm.output(output);
        ffm.on("error", function (error, stdout, stderr) {
            error.stderr = stderr;
            callback(error);
        });
        ffm.run();
        if (typeof(output) === "string") {
            // If 'output' is a file, the callback must be called after ffmpeg has finished (only then is the file ready)
            ffm.on("end", function () {
                callback();
            });
        } else {
            callback();
        }
        return ffm;
    }
}
752546
def main():
    """"""
    desc = 'Generate files to benchmark'
    parser = argparse.ArgumentParser(description=desc)
    parser.add_argument(
        '--src',
        dest='src_dir',
        default='src',
        help='The directory containing the templates'
    )
    parser.add_argument(
        '--out',
        dest='out_dir',
        default='generated',
        help='The output directory'
    )
    parser.add_argument(
        '--seed',
        dest='seed',
        default='13',
        help='The random seed (to ensure consistent regeneration)'
    )

    args = parser.parse_args()

    random.seed(int(args.seed))

    mkdir_p(args.out_dir)

    for template in templates_in(args.src_dir):
        modes = template.modes()

        n_range = template.range()
        for n_value in n_range:
            base = template.instantiate(n_value)
            for mode in modes:
                write_file(
                    os.path.join(
                        args.out_dir,
                        out_filename(template, n_value, mode)
                    ),
                    mode.convert_from(base)
                )
        write_file(
            os.path.join(args.out_dir, '{0}.json'.format(template.name)),
            json.dumps({
                'files': {
                    n: {
                        m.identifier: out_filename(template, n, m)
                        for m in modes
                    } for n in n_range
                },
                'name': template.name,
                'x_axis_label': template.property('x_axis_label'),
                'desc': template.property('desc'),
                'modes': {m.identifier: m.description() for m in modes}
            })
        )
257075
def command(name, nargs=0, complete=None, range=None, count=None, bang=False,
            register=False, sync=False, allow_nested=False, eval=None):
    """"""
    def dec(f):
        f._nvim_rpc_method_name = 'command:{}'.format(name)
        f._nvim_rpc_sync = sync
        f._nvim_bind = True
        f._nvim_prefix_plugin_path = True

        opts = {}

        if range is not None:
            opts['range'] = '' if range is True else str(range)
        elif count is not None:
            opts['count'] = count

        if bang:
            opts['bang'] = ''

        if register:
            opts['register'] = ''

        if nargs:
            opts['nargs'] = nargs

        if complete:
            opts['complete'] = complete

        if eval:
            opts['eval'] = eval

        if not sync and allow_nested:
            rpc_sync = "urgent"
        else:
            rpc_sync = sync

        f._nvim_rpc_spec = {
            'type': 'command',
            'name': name,
            'sync': rpc_sync,
            'opts': opts
        }
        return f
    return dec
1085270
def command(self, command, raw=False, timeout_ms=None):
    """"""
    return ''.join(self.streaming_command(command, raw, timeout_ms))
1245729
def enable_audio_video_cmd(param, enable):
    """"""
    cmd = 'configManager.cgi?action=setConfig'
    formats = [('Extra', 3), ('Main', 4)]
    if param == 'Video':
        formats.append(('Snap', 3))
    for fmt, num in formats:
        for i in range(num):
            cmd += '&Encode[0].{}Format[{}].{}Enable={}'.format(
                fmt, i, param, str(enable).lower())
    return cmd
396303
def generate(self):
        '''
        
        '''
        sampled_arr = np.zeros((self.__batch_size, self.__channel, self.__seq_len, self.__dim))

        for batch in range(self.__batch_size):
            for i in range(len(self.__program_list)):
                program_key = self.__program_list[i]
                key = np.random.randint(low=0, high=len(self.__midi_df_list))
                midi_df = self.__midi_df_list[key]
                midi_df = midi_df[midi_df.program == program_key]
                if midi_df.shape[0] < self.__seq_len:
                    continue

                row = np.random.uniform(
                    low=midi_df.start.min(), 
                    high=midi_df.end.max() - (self.__seq_len * self.__time_fraction)
                )
                for seq in range(self.__seq_len):
                    start = row + (seq * self.__time_fraction)
                    end = row + ((seq+1) * self.__time_fraction)
                    df = midi_df[(start <= midi_df.start) & (midi_df.start <= end)]
                    sampled_arr[batch, i, seq] = self.__convert_into_feature(df)

        return sampled_arr
137176
def transcode_movie
      FFMPEG.logger.info("Running transcoding...\n#{command}\n")
      @output = ""

      Open3.popen3(*command) do |_stdin, _stdout, stderr, wait_thr|
        begin
          yield(0.0) if block_given?
          next_line = Proc.new do |line|
            fix_encoding(line)
            @output << line
            if line.include?("time=")
              if line =~ /time=(\d+):(\d+):(\d+.\d+)/ # ffmpeg 0.8 and above style
                time = ($1.to_i * 3600) + ($2.to_i * 60) + $3.to_f
              else # better make sure it wont blow up in case of unexpected output
                time = 0.0
              end

              if @movie
                progress = time / @movie.duration
                yield(progress) if block_given?
              end
            end
          end

          if timeout
            stderr.each_with_timeout(wait_thr.pid, timeout, 'size=', &next_line)
          else
            stderr.each('size=', &next_line)
          end

        @errors << "ffmpeg returned non-zero exit code" unless wait_thr.value.success?

        rescue Timeout::Error => e
          FFMPEG.logger.error "Process hung...\n@command\n#{command}\nOutput\n#{@output}\n"
          raise Error, "Process hung. Full output: #{@output}"
        end
      end
    end
1115354
function encodeAMF3Cmd(opt) {
    var data = amf0EncodeOne(opt.cmd);

    if (rtmpCmdDecode[opt.cmd]) {
        rtmpCmdDecode[opt.cmd].forEach(function (n) {
            if (opt.hasOwnProperty(n))
                data = Buffer.concat([data, amf3EncodeOne(opt[n])]);
        });
    } else {
        console.log('Unknown command', opt);
    }
    return data
}
1205860
def make_movie(workdir, pf, dpi=120, fps=1, format="pdf", engine="ffmpeg"):
    
    os.chdir(workdir)
    if format != "png":
        cmd  = "parallel convert -density {}".format(dpi)
        cmd += " {} {.}.png ::: " + "*.{}".format(format)
        sh(cmd)

    assert engine in ("ffmpeg", "gifsicle"), \
            "Only ffmpeg or gifsicle is currently supported"
    if engine == "ffmpeg":
        cmd = "ffmpeg -framerate {} -pattern_type glob -i '*.png' {}.mp4"\
                .format(fps, pf)
    elif engine == "gifsicle":
        cmd  = "convert *.png gif:- |"
        cmd += " gifsicle --delay {} --loop --optimize=3".format(100 / fps)
        cmd += " --colors=256 --multifile - > {}.gif".format(pf)

    sh(cmd)
1366436
function ffmpeg(os) {
  var stdio = os.stdio===undefined? STDIO:os.stdio;
  return new Promise((fres, frej) => cp.exec(command(os), {stdio}, (err, stdout, stderr) => {
    if(err) frej(err);
    else fres({stdout, stderr});
  }));
}
304489
def generate(command,
             name,
             init_system,
             overwrite,
             deploy,
             start,
             verbose,
             **params):
    
    # TODO: Add a `prefix` flag which can be used to prefix
    # `COMMAND` with `su -c`, etc..
    try:
        Serv(init_system, verbose=verbose).generate(
            command, name, overwrite, deploy, start, **params)
    except ServError as ex:
        sys.exit(ex)
3604
def generate_dir_rst(src_dir, target_dir, gallery_conf, seen_backrefs):
    """"""

    head_ref = os.path.relpath(target_dir, gallery_conf['src_dir'])
    fhindex = """\n\n.. _sphx_glr_{0}:\n\n""".format(
        head_ref.replace(os.path.sep, '_'))

    with codecs.open(os.path.join(src_dir, 'README.txt'), 'r',
                     encoding='utf-8') as fid:
        fhindex += fid.read()
    # Add empty lines to avoid bug in issue #165
    fhindex += "\n\n"

    if not os.path.exists(target_dir):
        os.makedirs(target_dir)
    # get filenames
    listdir = [fname for fname in os.listdir(src_dir)
               if fname.endswith('.py')]
    # limit which to look at based on regex (similar to filename_pattern)
    listdir = [fname for fname in listdir
               if re.search(gallery_conf['ignore_pattern'],
                            os.path.normpath(os.path.join(src_dir, fname)))
               is None]
    # sort them
    sorted_listdir = sorted(
        listdir, key=gallery_conf['within_subsection_order'](src_dir))
    entries_text = []
    computation_times = []
    build_target_dir = os.path.relpath(target_dir, gallery_conf['src_dir'])
    iterator = sphinx_compatibility.status_iterator(
        sorted_listdir,
        'generating gallery for %s... ' % build_target_dir,
        length=len(sorted_listdir))
    clean_modules(gallery_conf, src_dir)  # fix gh-316
    for fname in iterator:
        intro, time_elapsed = generate_file_rst(
            fname, target_dir, src_dir, gallery_conf)
        clean_modules(gallery_conf, fname)
        src_file = os.path.normpath(os.path.join(src_dir, fname))
        computation_times.append((time_elapsed, src_file))
        this_entry = _thumbnail_div(target_dir, gallery_conf['src_dir'],
                                    fname, intro) + """

.. toctree::
   :hidden:

   /%s\n""" % os.path.join(build_target_dir, fname[:-3]).replace(os.sep, '/')
        entries_text.append(this_entry)

        if gallery_conf['backreferences_dir']:
            write_backreferences(seen_backrefs, gallery_conf,
                                 target_dir, fname, intro)

    for entry_text in entries_text:
        fhindex += entry_text

    # clear at the end of the section
    fhindex += """.. raw:: html\n
    <div style='clear:both'></div>\n\n"""

    return fhindex, computation_times
473728
def command(self, name, *args):
        """"""
        args = [name.encode('utf-8')] + [ (arg if type(arg) is bytes else str(arg).encode('utf-8'))
                for arg in args if arg is not None ] + [None]
        _mpv_command(self.handle, (c_char_p*len(args))(*args))
743584
def script(self):
        """"""
        self.shebang_header = self.shebang_headers[self.language]
        self.slurm_header   = [self.slurm_headers[k]['tag'] % v for k,v in self.slurm_params.items()]
        self.script_header  = self.script_headers[self.language]
        self.script_footer  = self.script_footers[self.language]
        return '\n'.join(flatter([self.shebang_header,
                                  self.slurm_header,
                                  self.script_header,
                                  self.command,
                                  self.script_footer]))