Manipulating videos from the commandline

Media_httpfilesmyoper_emqmk

TLLTS and other podcast comment on some of the software that has stalled in development on the Linux desktop. One of this is the video editing software. Today I started manipulating the videos I picked up yesterday. What happened was that I got a DVD full of different segments from my family home videos. These videos include:

  • My sister trip to Vancouver, Canada
  • My Girlfriend visit to Mexico
  • And finally, my sister high school graduation

The transfer to DVD inspired me because I know this videos will go rotten since this videos are becoming more obsolete on the formats like Betamax and 8mm tapes. When you transfer to digital now, you can get this data a new life, accessible from everywhere, from the cellphone, to the PDA and to every digital medium. However digital video is very flexible, the flexibility that software allow us to do is incredible and Linux has many tools arguably speaking of course. I manage to have in a few hours all the videos I needed on the format I wanted and the quality that I really have to get. First thing I did was having some of the steps:

  • Rip the DVD so I can have into Digital
  • Divide the video into more digestible bits
  • Have this clip on a smaller footprint taking care of the quality
  • Be able to play it on my PDA

So my first step was to use a GUI application, the first one that I tried was AcidRip which is a free software front end to mencoder and be able to set a bunch of configuration options that otherwise you will have no idea how to do it. The ripping part was a bit confusing because it has a progress bar that might not work because the numbers were all on 0, and the bar never really took off. However having he DVD spinning told me that there was something going on. I drop to the command line and I saw my output file appear and start to grow on size so that assured me that the ripping was going on. This gave me size of 670MB, for about 1:40 hrs of content. But now I have 3 different videos from what I mentioned before; I was interested on the video from my gf because I was eager to show it to her since she asked for it at one point and it would have been a nice surprise to send it to her. But this clip was in the middle of the whole video squences and now I needed to copy just the segment I need. My first option was to use Avidemux and do the croping. The progress was simple, go to the minute to start the selection, then go to the end of the selection and then just save it by going File > Save > Save Video. I did have a couple of difficulties triying to get to the exact minute to start and end the selection. I wanted to edit the time box but unfortunately I couldn’t get it, or have a Go to.. option. But my second grief was that the simple copy actually did some breaking that after minute 4.23, I lost the sound. Also I experience some de-syncing of the audio with the video. I start looking for alternative tools, probably more simple and I come to ffmpeg. I found a great ffmpeg tutorial to get the specifics on how to do my cropping with hopefully improved results. This tutorial hit on the head about what I needed to crop it. First I learned how to set the starting point to record, which was the option -t, then later was the more challenging which was how to set an end point. As opposed to set an end point you have to say for how long will the recording be happening. So instead having start at minute x and stop at point y, you have to say more like, start at minute x and record for y. Also other options like the tag for the incoming file and the output file. $ ffmpeg -i master_video.avi -ss 00:52:21.0 -t 00:03:25.21 master_clip.avi Here we got to tell the file take this file, go to minute 52.21 and record for 3.25 minute into the file master_clip.avi. This gave me a great video in the sense it was just at the exact point I want to start and stop recording. The problem was the quality was automatically set to crappy quality. So an option I found reading the man pages of ffmpeg was the flag -sameq which stand for same quality. Now that gave me a great video quality, superb I will say. However the file was almost 50mb for 3 minutes of video. Here is where I used my 770-encode script; but since I just learn my little lesson in quality I went on and also activate the quality to best. $ 770-encode -p=best master_clip.avi clip770.avi.

Advertisements