git + sympy video tutorial

5 views
Skip to first unread message

Ondrej Certik

unread,
Jun 12, 2009, 1:23:24 AM6/12/09
to sympy
Hi,

while fixing the issue:

http://code.google.com/p/sympy/issues/detail?id=1385

I recorded my terminal and I was also commenting what I was doing, so
that you can get an idea how to work with git, squash patches, switch
branches etc. And also how to write and run tests, doctests with
sympy.

It took me 23 minutes to record the video (e.g. to fix the issue).
Now it's more than an hour and I still can get the final video out.
Here are two files:

http://sage.math.washington.edu/home/ondrej/scratch/video/

audio and video, the just have to be combined together. Can someone
please help me with that? I am afraid it is not possible to do it on
my Ubuntu...

It took me about a weekend to try all video editing programs I found
on linux to realize that I am not able to force any of them to
actually record a terminal+sound, combine it together and not to loose
quality. So I wrote this script:

http://github.com/certik/record

that uses "recordmydesktop" that works pretty well, but even though it
can also record sound, in practice it can't (it's very very low
quality), so this python script also uses gstreamer to record sound,
it calls (alsasrc ! audioconvert ! flacenc ! filesink location=%s)
and that works. So I endup with two files, now I need to combine them
together. On smaller files mencoder works quite well, but on the above
files mencoder skips lots of frames and the result is unusable
(mplayer can play it properly). The trick is to convert the flac to
ogg (I used quality 10, so given my low quality microphones, this
doesn't loose anyting), then mencoder can produce a video with sound,
but the sound is about 0.5s (or 1s) delayed. Mencoder has an option
"-delay", but it doesn't seem to work (I didn't notice any difference
when played with mplayer afterwards).

So it's very sad, but I have to admit I can't even put the audio and
video together so that it is in sync. And originally I wanted to
record some short intro with my camera and then attach those two
things together --- well, this is totally impossible. I managed to get
something working with cinelerra, but it can't read my sound and video
for some reason, that my script above produced. It works with
sound+video coming from my camera though (e.g. allows me to do some
fancy transformations etc.). But since it doesn't work with camera and
video from the terminal, it's totally useless.

I think the problem may be in the format I am using for videos and/or
audios. But I am giving up. If anyone on this list knows how to get
this working on linux, I would be very grateful.

Ondrej

Ondrej Certik

unread,
Jun 12, 2009, 1:31:32 AM6/12/09
to sympy
On Thu, Jun 11, 2009 at 11:23 PM, Ondrej Certik<ond...@certik.cz> wrote:
> Hi,
>
> while fixing the issue:
>
> http://code.google.com/p/sympy/issues/detail?id=1385
>
> I recorded my terminal and I was also commenting what I was doing, so
> that you can get an idea how to work with git, squash patches, switch
> branches etc. And also how to write and run tests, doctests with
> sympy.
>
> It took me 23 minutes to record the video (e.g. to fix the issue).
> Now it's more than an hour and I still can get the final video out.
> Here are two files:
>
> http://sage.math.washington.edu/home/ondrej/scratch/video/
>
> audio and video, the just have to be combined together. Can someone
> please help me with that? I am afraid it is not possible to do it on
> my Ubuntu...

Also the sound volume needs to be increased, the audio is very quiet.

Ondrej

Vinzent Steinberg

unread,
Jun 12, 2009, 5:17:12 AM6/12/09
to sympy
Great idea!

With a proper video editing application it should be trivial to sync
the sound and increase the volume. I've never worked with Open Source
software of this kind, but I'd try this: http://www.kdenlive.org/

I'll give it a try this weekend.

Vinzent

Alan Bromborsky

unread,
Jun 12, 2009, 7:07:19 AM6/12/09
to sy...@googlegroups.com
Try attached script!
combine

Alan Bromborsky

unread,
Jun 12, 2009, 7:18:09 AM6/12/09
to sy...@googlegroups.com
Also Ondrej you might want to look at Turtle Beach SRM usb sound card
with built in stereo mic.

Alan Bromborsky

unread,
Jun 12, 2009, 7:21:46 AM6/12/09
to sy...@googlegroups.com
Here is the link I stole the script from:
http://movingparts.net/2009/02/11/screencasting-in-linux/

Alan Bromborsky

unread,
Jun 12, 2009, 10:23:08 AM6/12/09
to sy...@googlegroups.com
By the way I did try the script I sent you and it seemed to me that the
voice and video were in sync in the resulting file.

Ondrej Certik

unread,
Jun 12, 2009, 2:01:32 PM6/12/09
to sy...@googlegroups.com
On Fri, Jun 12, 2009 at 5:07 AM, Alan Bromborsky<abr...@verizon.net> wrote:
> Try attached script!

It gives me some duplicate frames several times per second:

...
Pos: 235.2s 3531f ( 0%) 21.11fps Trem: 0min 0mb A-V:0.024 [1027:143]
1 duplicate frame(s)!
Pos: 235.8s 3540f ( 0%) 21.11fps Trem: 0min 0mb A-V:0.022 [1025:143]
1 duplicate frame(s)!
Pos: 236.5s 3551f ( 0%) 21.11fps Trem: 0min 0mb A-V:0.021 [1026:143]
1 duplicate frame(s)!
Pos: 238.9s 3587f ( 0%) 21.11fps Trem: 0min 0mb A-V:0.022 [1022:143]
1 duplicate frame(s)!
Pos: 239.1s 3589f ( 0%) 21.11fps Trem: 0min 0mb A-V:0.024 [1021:143]
1 duplicate frame(s)!
Pos: 239.2s 3591f ( 0%) 21.11fps Trem: 0min 0mb A-V:0.025 [1021:143]
1 duplicate frame(s)!
Pos: 239.8s 3600f ( 0%) 21.11fps Trem: 0min 0mb A-V:0.020 [1019:143]
...


And when played with mplayer, it looks like the attached screenshot (I
scaled the image down, but you get the idea).

I suspect my mencoder doesn't work properly. My version is:

MEncoder 2:1.0~rc2-0ubuntu19+medibuntu1 (C) 2000-2007 MPlayer Team

which version do you have?

Ondrej

demo_full.png

Ondrej Certik

unread,
Jun 12, 2009, 2:34:56 PM6/12/09
to sy...@googlegroups.com
On Fri, Jun 12, 2009 at 3:17 AM, Vinzent
Steinberg<vinzent....@googlemail.com> wrote:
>
> Great idea!
>
> With a proper video editing application it should be trivial to sync
> the sound and increase the volume. I've never worked with Open Source
> software of this kind, but I'd try this: http://www.kdenlive.org/

I tried that one. It can't read the .ogv file (ogg theora file) on my
system (it's not among supported formats), so I set the open dialog to
all files, opened it anyways, but it shows it, but it can't play it...

But I just found, that you can find BSD licensed decoders and encoders here:

http://www.theora.org/

and they are in most distributions now anyways. I didn't find python
wrappers for it yet, but I'll probably just write cython wrappers
myself. Then hopefully I should be able to read the stream in Python
(possibly playback with pyglet) and join the audio myself in a simple
python script.

Being able to read, decode and encode video from Python itself would
help too, I actually need to create some nice videos that result from
my animations, so far I use mencoder, but having a small nice library
in Python would be better.


I am a little worried it will not work, because this program (that
should work for vorbis+theora) utterly fails:

$ ogmmerge -o out.ogm audio.ogg video.ogv
Using OGG/OGM demultiplexer for audio.ogg.
+-> Using Vorbis audio output module for stream 1.
Using OGG/OGM demultiplexer for video.ogv.
Error: the reader for video.ogv did not produce a header page.


It may be that the recorddesktop produces nonworking theora file.


Ondrej

Ondrej Certik

unread,
Jun 12, 2009, 2:35:46 PM6/12/09
to sy...@googlegroups.com
On Fri, Jun 12, 2009 at 12:34 PM, Ondrej Certik<ond...@certik.cz> wrote:
> On Fri, Jun 12, 2009 at 3:17 AM, Vinzent
> Steinberg<vinzent....@googlemail.com> wrote:
>>
>> Great idea!
>>
>> With a proper video editing application it should be trivial to sync
>> the sound and increase the volume. I've never worked with Open Source
>> software of this kind, but I'd try this: http://www.kdenlive.org/
>
> I tried that one. It can't read the .ogv file (ogg theora file) on my
> system (it's not among supported formats), so I set the open dialog to
> all files, opened it anyways, but it shows it, but it can't play it...
>
> But I just found, that you can find BSD licensed decoders and encoders here:
>
> http://www.theora.org/
>
> and they are in most distributions now anyways.  I didn't find python
> wrappers for it yet, but I'll probably just write cython wrappers
> myself. Then hopefully I should be able to read the stream in Python
> (possibly playback with pyglet) and join the audio  myself in a simple
> python script.
>
> Being able to read, decode and encode video from Python itself would
> help too, I actually need to create some nice videos that result from
> my animations, so far I use mencoder, but having a small nice library

animations -> simulations.

O.

Alan Bromborsky

unread,
Jun 12, 2009, 2:55:48 PM6/12/09
to sy...@googlegroups.com
> ------------------------------------------------------------------------
>
Here is my version of mencoder:

MEncoder 2:1.0~rc2-0ubuntu19+medibuntu1 (C) 2000-2007 MPlayer Team
CPU: AMD Opteron(tm) Processor 244 (Family: 15, Model: 5, Stepping: 10)
CPUflags: Type: 15 MMX: 1 MMX2: 1 3DNow: 1 3DNow2: 1 SSE: 1 SSE2: 1
Compiled with runtime CPU detection.


I get duplicate frames too, but I think the output file is OK. Run the
script for about a minute and view the output file.

Ondrej Certik

unread,
Jun 12, 2009, 3:04:33 PM6/12/09
to sy...@googlegroups.com

So you have the same version as I have.

>
>
> I get duplicate frames too, but I think the output file is OK.  Run the
> script for about a minute and view the output file.

I did exactly that and you can see the output is totally garbled.

Ondrej

Alan Bromborsky

unread,
Jun 12, 2009, 3:32:59 PM6/12/09
to sy...@googlegroups.com
The full mp4 output is 200MB. Suppose I run the script for 1 minute and
send the output to you to see if you can view it (on my machine it plays
fine on totem, vlc, and mplayer). Where should I send the file.

Alan Bromborsky

unread,
Jun 12, 2009, 3:37:49 PM6/12/09
to sy...@googlegroups.com
A 1 minute test run generates a 8.5 MB mp4 file.

Ondrej Certik

unread,
Jun 12, 2009, 6:06:37 PM6/12/09
to sy...@googlegroups.com

Send me your public ssh key offlist, I'll create you an account on my
server, so that you can upload it.

Thanks,
Ondrej

Vinzent Steinberg

unread,
Jun 12, 2009, 6:12:10 PM6/12/09
to sympy
kdenlive is really great software, I managed to combine video and
audio and to increase the volume. Rendering to Theora failed so far.
Do you want to give it a try or shall I upload the result somewhere
(once it works)?

Vinzent

On Jun 12, 11:17 am, Vinzent Steinberg

Alan Bromborsky

unread,
Jun 12, 2009, 6:27:02 PM6/12/09
to sy...@googlegroups.com
How do I find my public ssh key and then how do I upload the file. The
only thing I have ever used for file transfer is email.

Ondrej Certik

unread,
Jun 12, 2009, 7:31:19 PM6/12/09
to sy...@googlegroups.com
On Fri, Jun 12, 2009 at 4:12 PM, Vinzent
Steinberg<vinzent....@googlemail.com> wrote:
>
> kdenlive is really great software, I managed to combine video and
> audio and to increase the volume. Rendering to Theora failed so far.
> Do you want to give it a try or shall I upload the result somewhere
> (once it works)?

Upload it to youtube please.

Thanks a lot,
Ondrej

Ondrej Certik

unread,
Jun 12, 2009, 7:32:17 PM6/12/09
to sy...@googlegroups.com

You already figured out how to create the key, so to send a file, just do:

scp your_file.mp4 bro...@li21-74.members.linode.com:

and that's it.

Ondrej

Ryan Krauss

unread,
Jun 13, 2009, 11:23:48 PM6/13/09
to sy...@googlegroups.com
So, is this video now somewhere that anyone can get it?

Ondrej Certik

unread,
Jun 14, 2009, 12:39:27 AM6/14/09
to sy...@googlegroups.com
On Sat, Jun 13, 2009 at 9:23 PM, Ryan Krauss<ryan...@gmail.com> wrote:
> So, is this video now somewhere that anyone can get it?

Vinzent converted the video here:

http://sage.math.washington.edu/home/ondrej/scratch/video/

I think he said the quality is not so high, but it works.
Unfortunately, I can't play it with any player on my ubuntu.

Let me know if it works for you.

Ondrej

Tim Lahey

unread,
Jun 14, 2009, 4:06:36 AM6/14/09
to sy...@googlegroups.com

The mp4 file works fine for me using VLC on OS X, but it doesn't work
using any QuickTime based player.

Thanks!

Cheers,

Tim.

---
Tim Lahey
PhD Candidate, Systems Design Engineering
University of Waterloo
http://www.linkedin.com/in/timlahey

Alan Bromborsky

unread,
Jun 14, 2009, 7:28:23 AM6/14/09
to sy...@googlegroups.com
Ondrej - Should I send you the the complete video I encoded (200MB) the
same way I sent you the sample. I think the quality is fine. I can
even hear you input every keystroke and there is no problem with the
video quality.

Alan Bromborsky

unread,
Jun 14, 2009, 8:51:10 AM6/14/09
to sy...@googlegroups.com
I download Vinzent's video and compared with my version. Audio is
identical. My video is significantly clearer, but my file is 200MB
verses Vinzent's 115MB.

Ondrej Certik

unread,
Jun 14, 2009, 3:52:36 PM6/14/09
to sy...@googlegroups.com

Alan, yes, please upload your video the same way.

I can't play either of them, but I am going to uplaod it to vimeo and
we'll see. If they can play it, that's all that matters.


Thanks very much for the help,
Ondrej

Alan Bromborsky

unread,
Jun 14, 2009, 4:02:08 PM6/14/09
to sy...@googlegroups.com
The file is in transit!

Ondrej Certik

unread,
Jun 14, 2009, 10:58:04 PM6/14/09
to sy...@googlegroups.com

I uploaded it to vimeo:

http://vimeo.com/5157280

but it says "This video will start converting in a moment" and it say
that for 5 hours... So if you want to try and give it a shot too, just
go ahead.

Ondrej

Vinzent Steinberg

unread,
Jun 15, 2009, 4:54:35 AM6/15/09
to sympy
On Jun 15, 4:58 am, Ondrej Certik <ond...@certik.cz> wrote:
> I uploaded it to vimeo:
>
> http://vimeo.com/5157280
>
> but it says "This video will start converting in a moment" and it say
> that for 5 hours... So if you want to try and give it a shot too, just
> go ahead.
>
> Ondrej

It works nicely now, the video quality is awesome, but the volume is
extremely low. You can raise your system's volume until you understand
something, but there will be a nasty surprise if an ordinary sound is
played.

Vinzent

Ondrej Certik

unread,
Jun 15, 2009, 5:20:56 AM6/15/09
to sy...@googlegroups.com

It took them 10 hours to process it. Yes, the sound is too quiet, but
the video itself is excellent, very nice quality of the images. So
next time I'll fix the sound too and it will be usable.

Ondrej

Ryan Krauss

unread,
Jun 18, 2009, 8:45:18 AM6/18/09
to sy...@googlegroups.com
I was able to amplify the audio and created a 91meg avi that I think works in Linux and Windows.  Should I upload it somewhere?

Ondrej Certik

unread,
Jun 18, 2009, 9:55:54 AM6/18/09
to sy...@googlegroups.com
Yes, please upload it to vimeo.com.

Thanks,
Ondrej

Ryan Krauss

unread,
Jun 18, 2009, 1:18:54 PM6/18/09
to sy...@googlegroups.com
It won't be processed for a few hours, but it is uploaded and I think this will be it's url:
http://www.vimeo.com/5220215

Ryan Krauss

unread,
Jun 18, 2009, 3:22:48 PM6/18/09
to sy...@googlegroups.com
It has finished processing and seems to be working:
http://www.vimeo.com/5220215
Reply all
Reply to author
Forward
0 new messages