Minimalism at its finest...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Kruzen
    R3V Elite
    • Mar 2004
    • 5603

    #1

    Minimalism at its finest...



    Command line video editing, courtesy of ffmpeg for windows and python25 ;)

    each ripped dvd/avi is paired with a text file containing time codes for each movie (which are pre-determined scenes to be edited out).

    The python script reads through the text file, looks for the AVI file with a matching name, and then runs an ffmpeg command line which grabs that section of the AVI and re-encodes it as its own AVI file. Easy peasy japanesie. hours saved? ~20 on this portion of the project, roughly 60 hours total by the time i'm done. Much much easier than manually cutting each scene out using premiere, etc.
    Who doesn't love a little BBQ?
    Griot's Garage at a Deep Discount
  • ///Mayhew
    Wrencher
    • May 2007
    • 285

    #2
    wow you just confused the hell out of me. I am computer retarded.
    1989 325i MT2/4dr

    My life is not a journey to the grave with the intention of arriving safely in a pretty and well preserved body, but rather i will skid in broadside,thoroughly used up,totally worn out and loudly proclaiming....WOW..What a ride!

    Comment

    • cferb
      E30 Fanatic
      • May 2006
      • 1442

      #3
      Originally posted by ///Mayhew
      wow you just confused the hell out of me. I am computer retarded.
      +1, I wouldn't call myself computer retarded, but, I didn't understand a word of that
      sigpic

      Comment

      • JGood
        R3V OG
        • Jan 2004
        • 7959

        #4
        hahaha i like how your cpu has been pegged at 100% usage for who knows how long. So, why are you trying to get certain clips out of the movies? Or did I misunderstand what you are doing?
        85 325e m60b44 6 speed / 89 535i
        e30 restoration and V8 swap
        24 Hours of Lemons e30 build

        Comment

        • Farbin Kaiber
          Lil' Puppet
          • Jul 2007
          • 29502

          #5
          Sandlot. L7 Weenie. I could not figure what you could be cutting out of that random list of films.

          Comment

          • Jon325i
            R3V OG
            • Oct 2003
            • 6934

            #6
            Do I understand what he's doing? Yes.

            Do I know how to do what he's doing? Hell no.

            Good job man :up:

            Jon
            Rides...
            1991 325i - sold :(
            2004 2WD Frontier King Cab

            RIP #17 Jules Bianchi

            Comment

            • Kruzen
              R3V Elite
              • Mar 2004
              • 5603

              #7
              Originally posted by JGood
              hahaha i like how your cpu has been pegged at 100% usage for who knows how long. So, why are you trying to get certain clips out of the movies? Or did I misunderstand what you are doing?
              I'm cutting out clips from movies which obey the Fair Use requirements for educational media editing. Basically i'm compiling a dvd for teachers to use in the classroom to supplement some material they have. The dvd contains small clips from different movies to enforce different characteristics or values or some bullshit, so this saves them time from seeking to scenes on a bunch of dvd's. I haven't the damndest idea why they picked these clips, but these are the movies and clips i've been given.
              Who doesn't love a little BBQ?
              Griot's Garage at a Deep Discount

              Comment

              • Jean
                Moderator
                • Aug 2006
                • 18228

                #8
                Lol at ffmpeg :) I don't know how to use python, don't you still have to find the start/end times for the scenes you want to cut out ? Are you inputting them in python or something ?
                Mtech1 v8 build thread - https://www.r3vlimited.com/board/sho...d.php?t=413205



                OEM v8 manual chip or dme - https://www.r3vlimited.com/board/sho....php?p=4938827

                Comment

                • Kruzen
                  R3V Elite
                  • Mar 2004
                  • 5603

                  #9
                  Originally posted by Jean
                  Lol at ffmpeg :) I don't know how to use python, don't you still have to find the start/end times for the scenes you want to cut out ? Are you inputting them in python or something ?
                  Python is a programming language :) And I didn't have to find the start/end times, they were given to me (this is for my job).

                  This is what makes up 'cutme.py' http://en.wikipedia.org/wiki/Python_...ng_language%29 fo more information about python. Its just a short script that will pull the timecodes from the text files, look for a avi matched with the same name, and then pull those scenes, reincode them and save them as a new avi in the directory.

                  Code:
                  import os.path
                  
                  import subprocess
                  
                  import sys
                  
                  
                  
                  def timecode_to_sec(tc):
                  
                      """
                  
                      >>> timecode_to_sec('10') == 10
                  
                      True
                  
                  
                  
                      >>> timecode_to_sec('3:10') == 190
                  
                      True
                  
                  
                  
                      >>> timecode_to_sec('1:10:10') == 4210
                  
                      True
                  
                      """
                  
                      result = 0
                  
                      values = tc.split(':')
                  
                      values.reverse()
                  
                  
                  
                      for i in range(0, len(values)):
                  
                          result += int(values[i]) * (60 ** i)
                  
                  
                  
                      return result
                  
                  
                  
                  def run():
                  
                      file = open(sys.argv[1])
                  
                      clips = []
                  
                  
                  
                      for line in file:
                  
                          if line.strip() == '':
                  
                              continue
                  
                  
                  
                          clips.append(line.split(' ', 1))
                  
                  
                  
                      file.close()
                  
                  
                  
                      # this is stupid but i'm lazy
                  
                      input_file = os.path.splitext(sys.argv[1])[0] + '.avi'
                  
                      input_filename = os.path.splitext(input_file)
                  
                  
                  
                      for clip in clips:
                  
                          duration = timecode_to_sec(clip[1]) - timecode_to_sec(clip[0])
                  
                          args = {
                  
                              'seek': timecode_to_sec(clip[0]),
                  
                              'duration': duration,
                  
                              'input': input_file,
                  
                              'output': '%s_%s-%s%s' % (input_filename[0],
                  
                                                        clip[0].replace(':', '_').strip(),
                  
                                                        clip[1].replace(':', '_').strip(),
                  
                                                        input_filename[1])
                  
                          }
                  
                  
                  
                          cmd = 'ffmpeg -sameq -ss %(seek)s -t %(duration)d -i %(input)s -async 2 %(output)s' % args
                  
                          subprocess.call(cmd)
                  
                  
                  
                  if __name__ == '__main__':
                  
                      import doctest
                  
                      doctest.testmod()
                  
                      run()
                  Who doesn't love a little BBQ?
                  Griot's Garage at a Deep Discount

                  Comment

                  • equate975
                    No R3VLimiter
                    • Jun 2004
                    • 3382

                    #10
                    Yeah I understand it, but I didn't understand why until you posted its for class.

                    FYI, the little line in the top right corner lets you "minimize" them all ;)
                    Rollin' with a Geistkuchen

                    Comment

                    • schmidty
                      E30 Fanatic
                      • Jul 2004
                      • 1253

                      #11
                      # this is stupid but i'm lazy
                      haha, best comment ever

                      Comment

                      • Jordan325iC
                        E30 Mastermind
                        • Aug 2005
                        • 1697

                        #12
                        I love python.

                        '88 325is
                        VP UT of Austin Autoholics
                        BMWCCA 380364

                        Comment

                        • delatlanta1281
                          Dart Master
                          • Mar 2006
                          • 10317

                          #13
                          Ummmmmmmm
                          I don't like what you're doing.
                          I don't understand it therefore I fear it and must come kill you.
                          sorry
                          Yours truly,
                          Rich
                          sigpic
                          Originally posted by Rigmaster
                          you kids get off my lawn.....

                          Comment

                          • george graves
                            I waste 90% of my day here and all I got was this stupid title
                            • Oct 2003
                            • 19986

                            #14
                            You need dual monitors....
                            Originally posted by Matt-B
                            hey does anyone know anyone who gets upset and makes electronics?

                            Comment

                            • Kruzen
                              R3V Elite
                              • Mar 2004
                              • 5603

                              #15
                              Originally posted by george graves
                              You need dual monitors....
                              Meh, at home its a 22" CRT, my desk is too small for two :(

                              Here at work though is a 24" widescreen dell which suffices.
                              Who doesn't love a little BBQ?
                              Griot's Garage at a Deep Discount

                              Comment

                              Working...