This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Case Study: Let's Play

Tags: None
(comma "," separated)
User avatar
ewhac
Registered Member
Posts
36
Karma
0
OS

Case Study: Let's Play

Thu Sep 06, 2012 1:42 am
So, let's get the shameless self-promotion out of the way first... I made a Let's Play!

http://youtu.be/jnnrY7zbJQ8

Since I used Kdenlive 0.9.2 to make it, I thought it might be worth talking about the issues I encountered while trying to put it together.

Video Capture



Right off the bat, I had trouble capturing the footage in the first place. I went out and bought a Pinnacle Dazzle DVC-100, which is a USB standard-def video grabber, and for which mature Linux drivers exist. However, drivers are only a tiny portion of the equation. It turns out there are several ways you can capture footage from a V4L2 device, none of which work very well. I tried:
  • xawtv: Discovered and connected to the Dazzle immediately, but threw a ton of errors concerning audio underrun/overrun. Also, it defaulted to the smallest window size available, and resizing the window made it crash.
  • cheese: Apparently I don't have the Exact Version of the gstreamer libraries installed that cheese wanted, as the program hung while eating 100% of a CPU core.
  • ffmpeg: Sadly, it has a bug whereby it doesn't synchronize the audio and video input streams before it starts writing the output file, with the result that the audio and video are anywhere from slightly to laughably out of sync. I added my input to the ticket in ffmpeg's bug tracker.
  • Kdenlive: Sorry, didn't work at all. I wrote up my experience in these very fora a couple weeks ago.


So that left mencoder, which did a reasonable job. For those playing at home, here was the magic incancation:

mencoder tv:// -tv driver=v4l2:normid=0:input=1:width=720:height=480:forceaudio:immediatemode=0:amode=1:audiorate=48000:alsa:adevice=hw.1 -fps 30000/1001 -oac lavc -ovc lavc -lavcopts acodec=mp2:abitrate=384:vcodec=mpeg2video:vbitrate=8000 -of mpeg -mpegopts tsaf -o output_file.mpg

The -tv options were the hardest to get right. Here's what the less-obvious arguments mean:
  • driver=v4l2: Use V4L2 driver (as opposed to the older V4L driver) to talk to the device.
  • normid=0: Device-specific. The Pinnacle Dazzle can capture several video formats (NTSC, PAL, SECAM, etc.) This argument says to capture in NTSC.
  • input=1: Select S-Video input jack. Specifying input=0 will select the composite jack.
  • width=720:height=480: Capture dimensions.
  • forceaudio: Force audio capture, even if V4L/mencoder thinks there are no audio inputs.
  • immediatemode=0: Capture audio and video together. (Don't really understand this; why wouldn't you want to capture them together?)
  • amode=1: Audio capture mode; 1 means capture stereo.
  • audiorate=48000: Audio capture rate. There were some sites that said a rate of 32KHz was better for this, but I had no problem with 48KHz.
  • alsa: Capture using ALSA device (as opposed to OSS or ESD or Pulseaudio).
  • adevice=hw.1: The ALSA device to capture from (device-specific).


The rest were just tweaks to the encoder. A lot of this is Cargo Cult Programming, as I was trying suggestions cribbed from various other Web sites. I chose to encode as MPEG2, as my machine is about six years old and not beefy enough to encode H.264 in realtime; I reasoned that 8 MBits should be plenty. Also, I didn't have enough disk space to capture to DV. I didn't try MJPEG.

Soon after that, however, I found I needed to transcode everything to H.264/MP4, as slicing and dicing MPEG2 doesn't really work all that well (which may be obvious to everyone else reading, but was a comparative surprise to me ("Surely it will simply interpolate from the last available I-frame...").

Special Effects



I was particularly interested in getting one effect, where I spliced in some footage of me dying, then "rewinding" that segment, restarting it, and completing it successfully. This meant playing a video segment backwards. Turns out that's not possible.

...Okay, it sort of is possible. There were a couple of cryptic posts in these very fora describing how to do it. After working through what he was trying to say, it turns out you go to your command line and enter this command:

melt -profile square_ntsc framebuffer:input_video.mp4 reverse=1 -consumer xml:reversed_video.mlt


This will generate a file named reversed_video.mlt, which you then load as a clip and add to your timeline. Poof! you have a backwards-running clip -- although Kdenlive will stutter if you scrub the timeline over it, and rendering this segment is very slow. But it works.

...Except that it doesn't entirely. Not only did I want to "rewind" the clip, I wanted to do so at 8X speed. "No problem," thinks I, "Apply a Speed filter to the clip in the timeline, and set it to 800%." I regret to report that this does not work. Kdenlive gets very confused when you try to do this -- the reversed clip suddenly collapses to one or two frames in duration, but is still visible in the preview window, and still only plays back at 1X (or should I say -1X), and no amount of fiddling achieved the result I wanted.

Eventually I had to create new clips containing the reversed footage, and it seems the most popular tool for doing this is avidemux (although, oddly, it won't reverse the audio as well). About a half hour later, I had the reversed clips I needed. I put them in the timeline, applied a Speed filter set at 800%, and it worked just as I wanted. (A key-frameable Speed filter would have been even better, wish, wish...)

Final Composition



Once I had all the assets in place, putting it all together was cake. The only confusing moment was when I dragged the glowing green dot at the upper-left corner of a video clip to create a fade from back, but it instead created an audio fade. Not sure if I did anything wrong there.

I also used a fair amount of the key-frameable audio volume filter. It would have been nice to be able to add keyframes to the filter directly on the timeline. That is, I would have liked to have been able to say, "Add a new keyframe here," rather than have to scroll around for an existing keyframe and double-click on it, then try to find the place I had been working on. But that's a relatively minor complaint.

Once it previewed properly, I set it to rendering. Two hours of crunching (and four hours of uploading) later, it was on YouTube.

Kdenlive is earning a reputation with me as a solid and extremely useful tool. Thanks for all your excellent work.
normcross
Registered Member
Posts
300
Karma
0

Re: Case Study: Let's Play

Thu Sep 06, 2012 9:46 am
I personally have no knowledge whatsoever with regard to video capture, but I was particularly interested in your Special Effects section.

It has always been my belief that the Kdenline Developers have regarded reverse video as a low priority, which is fair enough, but there is the melt command line option for simple reversing which, as you found out, has severe limitations. I much prefer, let's call it, the hard copy output from avidemux. I'm not sure if reversing is regarded as just a 'fun' effect, but it's not.

In your case it was to show that you were going back to start again. In my case I was taking clips whist on a river cruise. When putting the video together, two or three scenes looked extra boring with only two clips for quite a number of seconds. Checking the return journey, I had taken more shots from a different distance and angle. Excellent, but going the wrong way and moving faster. So, avidemux and SlowmoVideo gave me exactly what I wanted. Made it less boring :-)

I think the green dot for audio fading is right in my opinion. I tend to use fade to/from black at the beginning, end and with some intermediate scene changes. If you're using numerous clip and their audio you can get annoying clicks and abrupt ends/starts.

Volume key-frameable. It doesn't work like that for me. I just add the effect, click once on the add key frame clock and a white line appears in the clip. Double clicking anywhere on the white line creates a key-frame at that position.
User avatar
ewhac
Registered Member
Posts
36
Karma
0
OS

Re: Case Study: Let's Play

Thu Sep 06, 2012 9:30 pm
I think the green dot for audio fading is right in my opinion. I tend to use fade to/from black at the beginning, end and with some intermediate scene changes. If you're using numerous clip and their audio you can get annoying clicks and abrupt ends/starts.
I think part of the problem is that the term "fade" is ambiguous. In Kdenlive, it appears that, if you want to adjust the audio level, you use "Fade". If you want to adjust the video level, you use "Fade from black" or "Fade to black". Which one you get by default from the glowing green circle isn't immediately apparent.

Volume key-frameable. It doesn't work like that for me. I just add the effect, click once on the add key frame clock and a white line appears in the clip. Double clicking anywhere on the white line creates a key-frame at that position.
I tried clicking on just the white line, but nothing happened. It's possible my aim was off, but I got the impression from the help bubbles and the actual behavior that you had to double-click on a pre-existing key frame to create a new one.


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], kde-naveen, Sogou [Bot], Yahoo [Bot]