Recently I volunteered to record video for the DrupalCamp Seattle 2008. It quickly dawned on me that to record 10 hours of video, bring it home and capture it to disk and then compress it would take 30+ hours. Also, that wouldn't be anywhere close to live and they were hoping to post the video as soon as possible. Since I am only running Linux on my laptops now, I decided to see what could be accomplished via command line tools in Linux. I quickly stumbled on ffmpeg and dvgrab. DVgrab can capture raw dv from firewire and has features for detecting scenes when capturing from tape. FFMPEG can also capture directly from the firewire, but specializes in converting (transcoding) video from one format to another.
When capturing directly from firewire using ffmpeg I would get glitches every now and then.
ffmpeg -f dv -i /dev/dv1394/0 -target ntsc-svcd output.mpg
FFMpeg takes an input file (or multiple input files) and an output file.
The parameters for each come before the file.
If I tried writing raw DV from ffmpeg I would get IO errors basically stating my computer couldn't andle the throughput.
But, dvgrab worked flawlessly!
dvgrab -format raw test.dv
Since both can use pipes I tried piping dvgrab directly into ffmpeg.
dvgrab -format dv1 - | ffmpeg -f dv -i - -target ntsc-vcd test.mpg
This worked wiithout any glitches.
So the next step was to figure out which format would give me the best compression vs. quality.
To do this I wrote a perl script which allowed me to easily experiment by converting a raw dv input file to various formats.
I have attached that script called encodetest.pl below.
After experimenting, I decided to go with flv since the video was to be posted to blip.tv, and blip.tv will convert anything posted to flv accept for flv which it leaves alone.
I tried posting some short xvid samples, ad they were taking an hour or more for blip.tv to convert, so flv had the additional advantage of being available instantly.
Next I wrote a very tiny perl script to encode video using the current timestamp as the filename and added it as a command to my desktop. Now all I had to do is literally click an icon to record and compress video to the conference. I have attached this perl script as well named rec_druplicon.pl
essentially the command it produces is:
dvgrab -format dv1 - | ffmpeg -deinterlace -f dv -i - -f flv -vcodec flv -s 480x270 -aspect 16:9 -qscale 3.5 -acodec libmp3lame -ab 32k -ar 22050 timestamp.flv
So how did it turn out?
As far as the recording, it went flawlessly. I was even able to post some of the videos during the next talk. The conditions could have been better. For some talks the lighting was poor in that the ambient light in the room was too bright to see the projector. In the main theatre, I was in the far back of the room and there was no PA, so the audio is faint, but the realtime recording/encoding worked better than expected. You can view all of the recordings at http://seadug.blip.tv/posts?view=archive&nsfw=dc
Some of the benefits of realtime encoding.
1. I could change tape without interupting the hard disk recording.
2. I could stop and start which automatically created multiple files named by timestamp.
3. All of the video from 2 days of recording fit easily n a DVD.
4. Most important, no slow post capture / compression so I was done as soon as I left the conference.
| Attachment | Size |
|---|---|
| encode_test.pl.txt | 12.82 KB |
| rec_druplicon.pl.txt | 956 bytes |
gracias, buscaba una opción
gracias, buscaba una opción para capturar video sin tener que ocupar mucho espacio en el disco duro. las opciones de compresión que ofreces son estupendas.
thnaks for all
thanks for allevden eve nakliyat
evden eve nakliyat
evden eve nakliyat goes on new pojects
Thanks
Thanks for all ankara web tasarım
realtime encoding doesn't work on my system
I tried your command lines, but I didn't got a realtime encoding. It seems that my pc is just grabbing dv video from my camera in 1gig pieces named -001.avi, -002, and so on, without encoding them. Cpu usage is very low.
I'm on ubuntu and tried also with a self compiled version of ffmpeg (and before with the medibuntu package). My system should be powerful enough (Athlon X2, 4gig ram). I cut and copied your string, and I can't find out what's wrong. May you or any other reader of this blog help me?
Thanks in advance
P.S. When I launch the commands, I get two warnings: Cannot set RR-scheduler and Cannot disable swapping
I got it
After two days of googling around hopelessly, I understood why your method wasn't working for me. It can be interesting for everyone has dvgrab 3.0 in his/her system. That version has stdout ( - ) broken. Man has to remove it and compile a newer ( or older) version from source. Hope it will be useful to someone.
Regdx, sorry for asking/writing something probably off topic to your blog, the reason is that's on top of google when searching about direct encoding or something similar...
yılan yağı
Saçların için yılanyağı kullan
sağlık
That is the solutionsağlıkeverybody want
That is the solutionsağlıkeverybody want
The content of fixing
Fixing automatically i all wantevden eve nakliyat
evden eve nakliyat
evden eve nakliyatkeep it up
sağlık
That is the solutionsağlıkeverybody want
evden eve nakliyat
en güzel evden eve nakliyat firmaları evden eve nakliyat ev nakli
oyun en iyi oyun
evden eve nakliyat taşımacılıkevden eve nakliyat evden eve nakliyat
evden eve nakliye nakliyat evden eve nakliyat
great tip - thanks!
I'm going to be taking a multiday train trip soon, and your tip will let me record as much of it as I want, without wasting expensive HI-8 tapes. I'm using mpeg4 instead of flv, it works to be roughly 250mb/hour in my early tests. I might bump the bitrate a little - none the less, it's way better than having to store the raw uncompressed dv files.
sweet
Very glad to see that someone found this and that it helped. Thanks for leaving a comment too!
me too
I am glad to see someone too evden eve nakliyat
evden eve nakliyat finding someone to write evden eve nakliyat
veryyy nice thanks...evden
veryyy nice thanks...evden eve nakliye nakliyat taşımacılık
nakliyat
nakliyat
evden eve
evden eve nakliyat
evden eve
aydın kız öğrenci yurdu
aydın kız öğrenci yurdu aydın kız öğrenci yurdu tanıtım sayfası.
çelik kapı firmaları çelik kapılar ahşap kapı dekorasyon
kral oyun kral oyun oynama sitesi
aydın kız öğrenci yurdu
aydın kız öğrenci yurdu aydın kız öğrenci yurdu tanıtım sayfası.
çelik kapı firmaları çelik kapılar ahşap kapı dekorasyon
kral oyun kral oyun oynama sitesi