it works!

sort of. so i managed to catch a cold in this strange weather (was in meeting yesterday so couldn’t capture on video, but we were all pausing at various times looking out that fantastic window view to sun-shining to cloudy to down pouring + thunder + lighting to back to clearing all within 1 hour…) Anywho, instead of resting this sore throat, i’ve been bugged a bit by problematic sound capturing things. why is it soo difficult, i wonder, to be able to just capture the sound from the internal system of a computer? clearly, the sound comes in from somewhere, can’t we just pipe it directly to a recorder? The problem seems even more complicated to capture “pictures” and sound at the same time… It seems like a paid product might be the way to proceed, $20 for ishowu i think…

but! i did make an effort! here‘s the result! i quite proud of this actually, given that i had to completely reinstall ubuntu on my personal laptop, then fiddled around for ages… in the end, it seems at least smaller pictures are possible… the sound was absolute crap just because it refuses to see the internal sound and insists on capturing via the input microphone… but no fear, i used an external clip from 3 days ago, with some quite detailed timing (down to 0.2 sec!), to produce the above product. doesn’t seem sustainable, but can be pet project for anyone curious in sorting out pictures + audio… still on list of things to do: a) crop clip, b) sort out how to capture audio properly at the same time w/ pictures… time to sleep.

anywho, below are only for my reference, some worked, one didn’t…
extract video only from clip:
ffmpeg -i out-1.ogv -an -vcodec copy out-2.ogv
extract audio:
ffmpeg -i ~/il_pianto_di_Maria1.mp3 -acodec copy -ss 00:11:51.7 -t 00:04:48 ~/clip1.mp3
merge with audio from separate clip, convert to mp4 using same quality (sameq)
ffmpeg -i out-2.ogv -vcodec mpeg4 -sameq -i clip1.mp3 -map 0:0 -map 1:0 out-3.mp4
ffmpeg -i clip1.ogv -vf “crop=80:120:120:80” -f mp4 test.mp4

command to try:
ffmpeg -f dshow -i video=screen-capture-recorder -r 24000/1001 -q 1 out.avi

and websites:


About thả diều
writing-challenged opera-addict

9 Responses to it works!

  1. thả diều says:

    Edition 1: Mac + iShowU
    so, i did end up getting ishowu (the very basic version for $20), it seems to do the job just as needed, no need for fancier tools or more expensive stuff. This is the table I used for capture. several things to note:
    a) Audio Input selection: “Record system audio” only = take internal sound, should be when capturing streams. Note to uncheck “record microphone”.
    b) Audio quality: clearly i chose the best quality here. It’s singing after all :-).
    c) Normal frame rate: 30 frame-per-sec is what the human eyes can process, faster = useless. slower = smaller file size but can be jerky.
    d) Compression: H.264 as explained here. All other compressions made big files, last night i tried “YUV…” something and ended up with a 20GB file!!! the pix quality was very good, but NO video is worth 20GB of space!
    e) Don’t record mouse: unless you want to record a demonstration, no mouse.
    f) Capture size: this one is defined by you. It’s related to the “Edit recording area” option at the bottom where you can define. For the file I wanted to record, it turned out making full screen is not good due to limitation of the original video source, i.e., expanding it to full screen results in jerky motion due to low res source, not due to recording issues. So in the end this was the best size.
    g) Countdown: leaves me enough time to turn on the video before capture started.
    h) Record for: can be set, for example, il pianto di Maria was 27min, so i set it for 27min15sec. This is good when you need to run to the restroom :-).
    i) Options: make sure to unclick “Follow mouse cursor”, try it and you’ll see why.

    That’s it, it recorded a beautiful video :-). Oh a few other things to remember prior to recording: turn OFF anything that will pop up on screen or make noise (skype, yahoomessenger, mail alert, etc.) since you’re recording both your screen and input sounds, surely you don’t want “you have mail” messages popping up in the capture and on audio. Finally, turn off SCREEN SAVER, else you’ll be recording that instead of what you want.

    ps– this is the first time i purchased a commercial product :-). Normally i always try my best to maneuver with command lines. In fact ffmpeg is truly the right tool, as it can call the system raw display and raw sound _with_ the appropriate commands. When have time i’ll try this next on ubuntu and report results here. This or this are the sites to visit. The trick is always to find out what the heck the “right” audio and video inputs are…


  2. thả diều says:

    Edition 2: Ubuntu, RecordMyDesktop, pavucontrol
    i’d consider this a big success. The key for audio is to start pavucontrol from a terminal as soon as recording started and change “Recording” to “Monitor of Built-in Audio Analog Stereo” as shown here. It turns out I actually prefer the radio recording much more (somehow it has much more dynamics), so i still keep it for the pet project 1 clip above. The final step was to crop, using this command:
    ffmpeg -i out-1.ogv -sameq -vf “crop=648:348:180:160” -an test.mkv (width:height:x:y)

    Interestingly, out-1.ogv has size 98MB for 360s of singing, and yet the above command reduced it down to 22MB with the addition of audio! so this is the best way to reduce the file size! Here’s the final product. Pretty cool if you ask me. Only thing is that RecordMyDesktop might not manage 30min clip. I tried once and the file vanished into thin air during encoding… might have been lack of disk space.


  3. thả diều says:

    Edition 3: Ubuntu, ffmpeg, pavucontrol

    The 3rd method is to use ffmpeg all the way. This required a complete reinstallation of ffmpeg and all of its dependencies (libx264 for encoding, enabling x11grab for screen capture). I followed this page step for step:
    screen shots 1, 2, 3 are included here in case that page disappears.
    Also this page for steps:

    Finally, here’s actual command:

    capturing both video and audio:
    ffmpeg -f alsa -ac 2 -i pulse -f x11grab -s 640×352 -r 20 -i 0:0+120,150 -vcodec libx264 -crf 0 -preset ultrafast -bufsize 43000 -an -y temp.mkv -acodec pcm_s16le -y output.wav

    use audio from separate clip:
    ffmpeg -i il_pianto_di_Maria.mp3 -acodec copy -ss 00:19:04 -t 00:09:30 clip4.mp3

    put audio + video together:
    ffmpeg -i clip4.mp3 -i section2.mkv -acodec copy -vcodec copy -map 0:0 -map 1:0 section2b.mkv

    It _almost_ worked like a charm, until i realized screen capturing is a very intensive procedure and not all machines can handle. So, 1 _major_ glitch: frames are dropped. In the end, i had 4 sec LESS in the video compared to audio! I could have used that audio clip as well but decided to go with the radio recording again. Here’s the product. You will notice some issue with matching up video and audio, first audio is ahead, then matched exactly around min 5, then lagged just slightly behind, simply because there’s more audio time then video. This is only a demonstration obviously. Unless I can sort out which codec to use to reduce CPU usage and remove frame-drop, this method, however incredibly wonderful it is, is not good enough. (Really, it’s such a marvel being able to just grab the display internally, i wish i can sort out the problem…). Anyhow, the video clip is huge, 1.27GB for 17min of singing!

    Lastly, i went ahead and reinstalled ffmpeg + all libraries + x11grab enabled flags on the mac, only to realize it can only grab a black screen, bummer. Otherwise, this would have been the perfect blend of capable computer + really cool commands. Just for completeness, this is the page to use for ffmpeg on mac (wherever that is, will find at a later time).

    So, this concludes my adventure to do screencast. My recommendation: if you own a mac, pay $20 to get iShowU, it does the trick in much much less time that ffmpeg :-). If you have a window machine, wipe it out and install ubuntu on it :-). Or actually dual boot like I do. Then install RecordMyDesktop, pavucontrol, AND ffmpeg. a combo of them will let you capture smaller videos (see all products/results above). Large screen-sized videos such as 1080i resolution are HUGE, several GB in space, need big computer and fast harddrive (solid state perhaps?) to be able to both encode + store on the fly.


    • Eyesometric says:

      I don’t understand a word of this but *really* appreciate the work you did to achieve “the product” 🙂


      • thả diều says:

        :-), you mean the product from next post? the one from edition 3 is out of sync. in the end, i thought the pictures are not as important as sound so i went for the original low-res size of tv broadcast. Had i figured this out before the broadcast, i would have managed to capture the very hi res version which I viewed that day.
        ps- just saw the tv program on last friday too, she said something about speaking english, “yes yes” 🙂 (about the same response we all gave when we first arrived in US and people kept asking us questions)


  4. Eyesometric says:

    Haha! and I had to start a new box as well :))


  5. Cat says:

    Oh thank god for macs… and thanks to you for the nice iShowU 101. Though I know what you mean – I’m partial to a little terminal action myself having started out many moons ago on Unix boxes. For a lot of batch file stuff it’s still faster and easier to bash out a little command line gobbledegook than faff around trying to figure out how to do it in the gui.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: