Saturday, April 07, 2007

automatic keyframing and the rotate effect

This is the second part of a two-part blog entry on rotating a transparent png in Cinelerra. Since we have created an interesting transparent gif:
http://crazedmuleproductions.blogspot.com/2007/04/transparent-png-as-rotating-image-on.html

Let's rotate it in Cinelerra!

I will do three things in this post:
1) load my project with only one video track, a static png image pulled to a length of 120 frames
2) apply a rotate effect to the track
3) use automatic keyframes to animate the rotate effect

Now, I must admit that I had misunderstood keyframing in Cinelerra. There are a number of ways to do keyframing, but when you work with effects, you will use automatic keyframing. Do yourself a favor and refresh your memory via the manual:
http://cvs.cinelerra.org/docs/cinelerra_cv_manual_en.html or the wiki:
http://cvs.cinelerra.org/docs/wiki/doku.php?id=english_manual:cinelerra_cv_en_17

First, I create a new project by typing "n" using the following specifications:


After we've loaded the project, we will have three preexisting tracks (two audio and one video track). Moving the cursor over any track and clicking the letter "d" to delete the last track on the timeline. We click "d" three times to delete the tracks.

Now, we load the png image I created in the last post noted above:


However, before we add this image as a new resource, a nice feature of Cinelerra is the ability to import images to a specific length onto the timeline. This is configured in Preferences -> Recording. Don't ask me why it is in the Recording dialog, but therein lies the Images section with one checkbox: "Import images with a duration of ." We will change this value to 4 seconds and click OK:


Now we can append the compass png to a new track by pressing the "o" key to Load a new resource. Before we select our png, we make sure to change the Insertion Strategy to Append in New Tracks:


The png will appear on the timeline with a length of four seconds. From the Resources box, pull a Rotate video effect on top of the track. We should now have a screen that looks like this:


We will now rotate our image. To do this, we will learn how to auto keyframe. For automatic keyframing to work, you first must have the little key icon ("Generate keyframes while tweeking") selected in either the project/timeline view or the compositor:


Once the key icon is lit, we will put the insertion point at equal intervals of 0 frames, 30 frames, 60 frames, 90 frames and 120 frames and set keyframe points. To do this, first move the insertion point to the beginning of the timeline, the 0 frame mark. In order to get frames to be the unit of measure on the time bar, cycle through the different time bar measurement options by clicking Shift-click while your mouse is on top of the time bar. Also make sure that Settings -> Align to Frames is chosen.

Once the insertion point is on our first 0 frame mark, go ahead and click the magnifying glass icon on the Rotate effect. The effect shows default degrees of rotation as well as a custom degree text box. Pivot on X and Y coordinates may be selected, but we will not change these values. Draw pivot simply puts a crosshair on the output.

We will keep it simple and set this first rotation point to 0 degrees:


Have the Compositor window showing while you perform the next few rotate keyframes. Repeat this process of selecting a new insertion point and increasing the rotation. Set the 30 frame mark to 90 degrees, the 60 frame mark to 180 degrees, the 90 frame mark to 270 degrees and the 120 frame mark to 360 degrees. As you change keyframes, you should see the output in the compositor change as well. At the end of the process, you should now have a timeline that looks something like this:


Once all the keyframe points are set, deselect the "Generate keyframes while tweeking" icon. We do this so in case we inadvertantly press a key, we don't start generating keyframes unknowingly. After the keyframes are set, set the insertion point back to the beginning of the timeline by pressing CTRL-left arrow and hit the spacebar to replay.

Et Voila! You should have successfully rotated your image! Thank Cinelerra's interpolation engine for the way that the intervening frames are rendered in the video playback. Nice!

Soon, I will post the rendered result for you to compare your results. And in my next post, we'll apply the perspective effect to make the rotate MUCH cooler!

Friday, April 06, 2007

transparent png as a rotating image for video

So I just watched Casino Royale for the third time and I really dug the GUIs they showed at various times during the film. One of the coolest was a graphic of a compass/altimeter as it focuses in on the compound of a bad guy in the Bahamas. I thought that adding something similar to my videos would be damn cool and should be fairly easy to do with transparent gif and the rotate effect in Cinelerra. I didn't know it, but I was about to get a lesson in automatic keyframing of effects, which I've never done before. But first, I will focus this blog entry on the transparent gif creation.

The plan was to get a gif or jpeg image of a compass, turn the background transparent and colorize the black lines of the compass. Later on, we'll rotate the image and fool with the perspective, like this:
Rotating compass
2.7MB

As I am not a very skilled user with Gimp, I thought I would keep my life simple and grab a black and white graphic of a compass off of the web to use as the image to rotate:


I loaded the image into Gimp. This particular image was already a transparent gif, so that saved me the step of adding an alpha (transparent) layer. I then cropped the image to the desired area by selecting the area I wanted using the Rectangle Select (Free Select). I erased the extra bits around the edges using the Erase with a Fuzzy Circle brush with a diameter of 76 pixels:


The large diameter brush was necessary due to the fact that the image was fairly large (1224x1142).

When I looked at the lines of my "compass", the lines appear fairly thin and weak:


Most likely, they would not show up very well overlayed on a video. So I needed to thicken them up. In order to use most of the filters in Gimp, you need to convert the image to RGB. So, I converted the image from Indexed to RGB using Image -> Mode -> RGB. RGB mode enabled me to try out some filters.

To thicken up the lines of the compass, I first used Filters -> Edge-Detect -> Difference of Gaussians with a Radius 1 of 3 and a Radius 2 of 1 pixels. I deselected the invert checkbox. This thickened the lines nicely, but not enough to really stand out. So after playing with a number of filters, I found the perfect one: Filters -> Edge-Detect -> Neon. I left the Radius at 5 and cranked up the Amount to 1.00 to really fatten up those weak, thin lines:

I needed to select a very bright color that would stand out overlayed on a video. To do this, I needed to select all the areas of the same color and drag my chosen color on top of the selected region. First, I chose Select Regions by Color and clicked on part of the compass. This selected all regions of the same color in the graphic. I then chose a suitably bright color for the new color of the compass (#21f811) and dragged that color from the color selection box on top of the selected region:



Finally, as the Neon effect had made the lines a bit jaggy, I deselected my regions of color (Select -> None) then applied a Gaussian Blur of 1 horizontal and 1 vertical pixel using IIR blur method. This rounded those sharp edges, but tended to mute the colors a bit:


I will try to improve the brightness of the selection by using a Neon gradient. That will be a future entry.

I saved the final image as a PNG:


that Cinelerra could import:


Next: automatic keyframing using the rotate effect!

Thursday, March 29, 2007

Fedora Core 6 on x86 Cinelerra dependencies

I'm preparing to upgrade my Fedora Core 4 system to Fedora Core 6 and have figured out how to install the source dependencies for Cinelerra in Core 6 relatively painlessly in an instance of a VMware virtual machine.

I use yum to install the dependent packages.

I needed to do the installation in a number of separate steps, due to some repository conflicts for ffmpeg-devel sources between the fedora base and livna repos, as well as some trickiness with mjpegtools.

Here are the steps:
1) make sure you have the correct repositories in yum.
2) install the dependencies using the shell script below
- this script includes everything except mjpegtools
3) remove the livna repositories from yum and install mjpegtools (ffmpeg-devel, optional)
4) get the source code
5) compile Cinelerra from source

Step 1: Make sure yum repositories are available
In order to install Cinelerra from source, you will need to have the following repositories in yum:
1) fedora core, extras and updates
2) dries
3) livna

3/31/07 Note: do NOT have the freshrpms repository listed in yum when you do the install.

The Cinelerra CVS source code will not compile against the ffmpeg in Freshrpms. Reference: https://init.linpro.no/pipermail/skolelinux.no/cinelerra/2007-March/010361.html

Here's a nice rpm that installs the livna repositories into yum for you: rpm -ivh http://rpm.livna.org/livna-release-6.rpm

And don't forget the RPM key imports for each repository, such as the dries key: rpm -ivh http://dries.ulyssis.org/rpm/RPM-GPG-KEY.dries.txt

Step 2: Install dependent files
Here is the list of dependencies needed, already in the form of a shell script ready for you to cut-and-paste into your favorite text editor:
yum install \
libquicktime \
gsm-devel \
xvidcore* \
lame \
lame-devel \
libvorbis* \
libogg* \
libtool* \
a52* \
libtheora* \
libpng* \
libjpeg* \
libtiff* \
esound* \
audiofile* \
libraw1394* \
libavc1394* \
freetype* \
fontconfig* \
nasm \
e2fsprogs* \
faad2-dev* \
OpenEXR* \
fftw3* \
libsndfile* \
libiec61883* \
x264 \
x264-d* \
faac* \
libdv*

Don't forget to chmod a+x the file!

Steps 3: Install mjpegtools
Remove the livna repositories from yum and install ffmpeg-devel and mjpegtools:
4/3/07 addition (thanks Roland!)
yum --disablerepo=livna install mjpegtools*

If you wish, you may install ffmpeg-devel. But it is not essential for Cinelerra compilation.

Step 4: Get Cinelerra source code
Getting the source files assumes that you have subversion installed:
yum install subversion

Then checkout the Cinelerra CVS trunk:
svn checkout svn://svn.skolelinux.org/cinelerra/trunk/hvirtual

Step 5: Build from source
Build the source from the hvirtual directory:
./autogen.sh
./configure
make
make install

Here are some scripts that show the different portions of the installation process. You'll see the ffmpeg-libs and -devel conflicts at the bottom of script 1. In script 2, I've removed ffmpeg-devel from the initial install. Script 3 shows the successful install of ffmpeg-devel from the dries and fedora extras repositories. Script 4 shows the successful install of mjpegtools. Script 5/6 show the configure and make/make install processes.

typescript.1
typescript.2no_ffmpeg
typescript.3ffmpeg-devel
typescript.4mjpeg
typescript.5configure
typescript.6makeinstall

enjoy!

ALERT!
ALERT!
Just in case you follow these steps and get the dreaded x264 compile error: 'struct ' has no member named 'b_cbr' error, here are the steps to fix it:
http://crazedmuleproductions.blogspot.com/2007/06/dreaded-compilation-error-x264c139.html

Friday, March 16, 2007

grungy, grainy video effect

I wanted to degrade a video to black and white and give it a grainy effect. Here's what I started with:


I then used the following settings to extract the color from the image:


The image then looked like this:


I then applied a histogram effect, tweaking the red/blue/green channels only allowing the higher frequencies:



To give the image a grainy look:


However, the grains looked too sharp, so I applied a blur using a pixel width of 8:


To this result:


Here's a test video (4.7MB):
test video

The next experiment will tweak the audio for additional weirdness.

Sunday, March 04, 2007

perspective effect used for titles

To begin a recent video, I wanted to simulate the Star Wars introductory title trick, where the titles start close and then fade off into the distance. To do this, I used the Perspective effect. I began with a very simple scrolling title. Note that a Motion Type of "Bottom to Top" is selected, as well as a speed to provide the motion:



I began the experiment with a very plain title:


I then applied the Perspective effect to the title:



And clicked on the magnifying glass to start playing around with the parameters of the effect:


The grid shown represents a flat, two-dimensional space, but grabbing and moving each of the four corners of the grid will create the illusion of three-dimensional space:


Note in the above image that the lower grid corners have been pulled and stretched wider than the dialog box in order for the titles to be really stretched. This enhances the perception of depth, as shown below:


It is extremely effective to apply the perspective effect in combination with some motion. Here is the final result:
perspective_test.mpg
23MB

Monday, February 12, 2007

the big picture

With the dualdvd archive piece and scripted workflow, I was able to optimize a couple of pieces of the video production lifecycle:

idea creation -> storyboard -> production -> distribution -> marketing -> archive

Update 2008/11/22
I've added a few more details to my workflow in a new post here.
end update

I fear I'm spending too much time on the production piece and all the associated technical details. However, from a business perspective, the devil is in the details and if you have a good workflow, that means that you can do more in less time and be able to dedicated more time to the more creative/marketing aspects. So I don't think it is for nothing that I am doing this. Too bad I can't get those darn Ximeta NDAS drivers to work on Linux!!

Sunday, February 11, 2007

MediaGate - Ximeta NDAS troubles with Linux

The MediaGate MG-350HD is a little wireless device that allows me to view my Cinelerra creations on my HDTV.


So, I'm trying to get it to work smoothly with Linux, as that's where my HD source files are. However, HD files will only play on the MediaGate if the files are either:
1) accessed via network share over wired connection or
2) copied via NDAS drivers to the hard drive installed in the thing

Ximeta (http://www.ximeta.com/) are the makers of the network direct attached storage (NDAS) that the MediaGate uses. I don't have a hard run down to my entertainment center, so I've been pulling my hair out in order to get the NDAS drivers working. The problem with this is that the drivers seem to work on XP only. The Linux drivers on Ximeta's site don't work worth a damn. They fail on my fedora and redhat enterprise boxes and on the two Ubuntu installs (6.0.6/6.1.0) that I did this morning. Yarg. In addition, I've tried upgrading the firmware to no avail. The frustrating thing is that the firmware is supposed to fix a problem where the MG can't do wired and wireless connections at the same time. In point of fact, the firmware upgrade has BROKEN wireless. Double YARG!!

2/11 Update: I've since fixed the wireless by first doing an AP (access point) scan of the enviroment first, and then changing the wireless mode to Ad Hoc to configure the security settings of my specific router. Gads!

So I think I'm just going to leave it wired upstairs for now, copy over the HD content when its ready and bring it back down to the HDTV. What a waste of time..I'm going to send the bozos an email.

2/19/2007 Update: A wirelessly mounted MediaGate is now working!!

Saturday, February 10, 2007

scripted rendering!

I am very happy to say that I've been able to script a couple pieces of the rendering process. Once I've edited my HDV masterpiece, I export out an .m2v file and an mp3, layer 2 file, according to my previous post:
http://crazedmuleproductions.blogspot.com/2006/11/cam-compatible-hdv-edit-chain-part-ii.html

I then use the following script to:
1) combine the .m2v and .m2a as a program stream (using mplex)
2) convert the program stream to a transport stream, MPEG-TS file (using VLC)
3) convert the MPEG-TS to a DVD compatible mpg (using ffmpeg)
4) lastly, convert the DVD to an iTunes compatible format (again, using ffmpeg)

Obviously, their is inherent quality loss in each step. I tried to eliminate one conversion step by rendering to the iTunes format direct from the HDV source, but for some reason, ffmpeg gave me errors. So, I saved time and just converted from the DVD source. I will revisit this problem in a later post.

I can say that scripting VLC kicks ass! No more GUI!! Yay!

Here is the script. Don't forget to "chmod a+x " in order to run it.

Note that when run, the script will ask for a filename. That filename must be common to the .m2v and .m2a files. For example, start with two files called test.m2v and test.m2a. The script will prompt you for the filename, at which point you will enter "test" and hit enter. After that, the script will chug away and render each of the files to the filename test., where format will vary by the destination type (.ps/.m2t/.mpg/.mov).

Good luck!

#!/bin/bash -v
#
# This script converts HDV content
echo "Type in the name of the m2a/m2v files for mplex'ing"
read NAME
echo "Mplex'ing $NAME"
mplex -f 3 -b 2000 ${NAME}.m2a ${NAME}.m2v -o ${NAME}.ps

echo "VLC'ing $NAME"
vlc $NAME.ps --sout '#duplicate{dst=std{access=file,mux=ts,dst="'$NAME'.m2t"}}' vlc:quit

echo "FFMPEG convert to DVD"
ffmpeg -i ${NAME}.m2t -target dvd ${NAME}.mpg

echo "FFMPEG convert to MOV"
ffmpeg -i ${NAME}.m2t -f mov -vcodec mpeg4 -qscale 7 -s 320x180 -r 29.97 -aspect 16:9 -acodec aac -ac 2 -ab 128 ${NAME}.mov
echo "Done"

Friday, February 09, 2007

backing up your HDV content with dual-layer DVD

I finally made the jump to dual DVDs. I successfully burned a dual layer dvd using growisofs! I am very excited! This means I can get that content OFF my hard drives..FINALLY! However, there is a 4.3GB file size limitation, so keep those MPEGTS's small. Or, if you have files you need to backup that are larger than 4.3GB, go ahead and split them using AVIDEMUX.

First, get and install the dvd+rw-tools from here:
http://fy.chalmers.se/~appro/linux/DVD+RW/tools/

The install requires you to:
1) untar/gunzip the source files
2) run "make"
3) run "make install"

After that, the tools should be installed. Once the tools are installed, load up a dual-layer disc and check your media:
dvd+rw-mediainfo /dev/hda

You'll get output similar to this:
[gagazote@computer hvirtual]# dvd+rw-mediainfo /dev/hda
INQUIRY: [_NEC ][DVD_RW ND-3500AG][2.16]
GET [CURRENT] CONFIGURATION:
Mounted Media: 2Bh, DVD+R Double Layer
Media ID: MKM/001
Current Write Speed: 6.1x1385=8467KB/s
Write Speed #0: 6.1x1385=8467KB/s
Write Speed #1: 5.1x1385=7056KB/s
Write Speed #2: 4.1x1385=5645KB/s
Write Speed #3: 3.1x1385=4234KB/s
Write Speed #4: 2.0x1385=2822KB/s
Write Speed #5: 1.0x1385=1411KB/s
GET [CURRENT] PERFORMANCE:
Write Performance: 4.0x1385=5540KB/s@[0 -> 4173824]
Speed Descriptor#0: 00/4173824 R@5.0x1385=6925KB/s W@4.0x1385=5540KB/s
Speed Descriptor#1: 00/4173824 R@5.0x1385=6925KB/s W@2.4x1385=3324KB/s
DVD+R DOUBLE LAYER BOUNDARY INFORMATION:
L0 Data Zone Capacity: 2086912*2KB, can still be set
READ DISC INFORMATION:
Disc status: blank
Number of Sessions: 1
State of Last Session: empty
Number of Tracks: 1
READ TRACK INFORMATION[#1]:
Track State: blank
Track Start Address: 0*2KB
Next Writable Address: 0*2KB
Free Blocks: 4173824*2KB
Track Size: 4173824*2KB
ROM Compatibility LBA: 262144
READ CAPACITY: 1*2048=2048


Then, burn your files:
growisofs -Z /dev/hda -R -J /mnt/videos/*

This command creates an ISO 9660 image of the directory "/mnt/videos" and writes it to a dual-layer DVD.
-Z erases any previous contents
-R include rockridge extensions
-J include joliet extentions

Thursday, February 08, 2007

Cinelerra hanging after I move audio on the timeline

This is a bit off topic, but is related to troubleshooting Cinelerra. I have been having a problem with Cinelerra hanging for three or four minutes after I zoom in and slide audio tracks around on the timeline. To replicate the problem, I grabbed and moved the audio track (a wav file) around quite a bit, perhaps 10 times. In order to find the hanging thread, I started gdb ("gdb cinelerra pid").
[root@localhost ~]# ps -ef | grep cin
root 3671 3571 90 20:05 pts/2 00:17:55 cinelerra
root 4263 4178 0 20:25 pts/4 00:00:00 grep cin
[root@localhost ~]# gdb cinelerra 3671


Scrolling through the thread list, I identified the offending thread:

> Thread 65 (Thread -1520473168 (LWP 5674)):
> #0 0x0813fceb in CacheBase::get_oldest (this=0x8c04068) at cachebase.C:106
> #1 0x081f00bb in MWindow::age_caches (this=0xbfc5a288) at
> mwindow.C:1569
> #2 0x081f5e7b in MWindow::move_edits (this=0xbfc5a288, edits=0x8539b70,
> track=0x920f238, position=49.724958333333333, behaviour=1) at
> mwindowedit.C:830
> #3 0x08289ed6 in TrackCanvas::drag_stop (this=0xa9e1e7e0) at
> trackcanvas.C:575
> #4 0x0828a13d in TrackCanvas::drag_stop_event (this=0xa9e1e7e0) at
> trackcanvas.C:325
> #5 0xb7b73029 in BC_WindowBase::dispatch_drag_stop (this=0xa9e1e7e0) at
> bcwindowbase.C:1316
> #6 0xb7b7300e in BC_WindowBase::dispatch_drag_stop (this=0x8c44da0) at
> bcwindowbase.C:1311
> #7 0xb7b73122 in BC_WindowBase::dispatch_button_release
> (this=0x8c44da0) at bcwindowbase.C:1162
> #8 0xb7b778b1 in BC_WindowBase::dispatch_event (this=0x8c44da0) at
> bcwindowbase.C:787
> #9 0xb7b78739 in BC_WindowBase::run_window (this=0x8c44da0) at
> bcwindowbase.C:614
> #10 0xb7b88bb8 in Thread::entrypoint (parameters=0xbfc5a288) at
> thread.C:48
> #11 0x00da0b80 in start_thread () from /lib/libpthread.so.0
> #12 0x00c11dee in clone () from /lib/libc.so.6


I then exited gdb and found that the process hang was still occurring.
In order to step through the program code, I use kdbg, a graphical debugger. I started up kdbg ("kdbg -p /usr/local/bin/cinelerra") and
selected "View -> Threads". I then used an alternating combination of
F8 and F10 to step in and out of the code. I found that kdbg hung at
this line of code: MWindow.C:1561. It took a while, maybe five minutes
for kdbg to free up. This indicates where the hang is occurring. After the release, I exited the debugger.

Here is the snippet of hvirtual/cinelerra/mwindow.C code starting at
line 1561:

> if(memory_usage > preferences->cache_size)
> {
> int target = 1;
> int oldest1 = audio_cache->get_oldest();
> int oldest2 = video_cache->get_oldest();
> if(oldest2 < target =" 2;"> int oldest3 = frame_cache->get_oldest();
> if(oldest3 <> target = 3;
> int oldest4 = wave_cache->get_oldest();
> if(oldest4 <> oldest4 < target =" 4;"> switch(target)
> {
> case 1: audio_cache->delete_oldest();
> break;
> case 2: video_cache->delete_oldest();
> break;
> case 3: frame_cache->delete_oldest();
> break;
> case 4: wave_cache->delete_oldest();
> break;
> }
> }

I'm not a very experienced C programmer, but inferring from the if statement, it looks like I only go into this control structure if cin's memory usage is
greater than the value stated in Preferences -> Cache Size. I have it
set to the default value of 10MB.

I have not yet found the cause of this particular hang, but I will update my blog once I have an answer.

Sunday, February 04, 2007

AVIDEMUX is an excellent little program..

Rough cuts video of any format and saves to any format rapidly. I used it to chop up a 7GB MPEGTS HDV file and it took one minute to render out a 2.7GB! This is much better than using Cinelerra to reduce it via a re-render via Quicktime. Sweet! I don't see any loss in the image, but that will need more investigation. Still, initial impressions are very good!

Wednesday, January 31, 2007

using the histogram function to turn on the light

Wow. I used the histogram function to lighten up a dark video. It really did wonders. I simply changed the Value parameter as in the graphic below:


Here are the results. Before applying histogram:

After applying histogram:


Test videos:
Before
(3Mb)
After
(4Mb)

Reference
Here are two articles on histograms and their purpose. The second taught me a great deal:
http://en.wikipedia.org/wiki/Image_histogram
http://www.illustratedphotography.com/photography-tips/basic/contrast

Wednesday, January 03, 2007

MediaGate MG-350HD review

Happy New Year folks! I thought I'd take a break from the usual Cinelerra-HDV talk to discuss a new toy I got for Christmas: the MediaGate MG-350HD.


Since I am in a band and am its archivist, I have a lot of audio and video files that I've created over the years. So I wanted to get a device that would playback the high-definition videos and audio I've recorded on my home theater. The MediaGate MG-350HD seemed to fit the bill as an all-in-one media player: it plays video and audio files of almost any type (no Quicktimes, though) streamed from one or more network shares via wired or wireless ethernet connection. It also plays files from an attached USB drive or hard drive you supply and can act as a network storage device. In practice, the device works well enough with its bare bones setup and media selection/playback interfaces, but needs more setup and careful installation than the shiny brochure would have you believe.

I will tailor the following discussion to technically inclined individuals who will read the MGs' manual or search google for reviews and information that has already been discussed. You can get the manual and firmware upgrades online from http://www.airlinktek.com/ in the Support section. I will highlight the time consuming points for me or information about the device that is lacking in the online resources. It is best if one reads the manual first. Though the supplied manual has enough information to get the device setup and working, it is poorly written by a non-native english speaker.

For those who don't like reading manuals, my suggestion would be to simply hook it up to your TV using any of the provided composite, svideo, component or DVI connections, turn it on and press "setup" on the remote. If you don't have a picture on the TV immediately, select an alternate video mode by pressing the "TV out" button multiple times to cycle through the different options. With the remote, you control all the device configuration and media playback functions of the MediaGate.

After opening the box, I decided to configure the device in logical fashion by trying out the simpler functions and then advance to the more complicated setups:
- attach a USB drive and play files from it
* USB setup was easy and playback worked using my Corsair Voyager 2GB USB drive, though you cannot copy files to the USB drive.
- install a hard drive into the unit and play files from it
* Drive setup was also easy using an 80GB drive I had lying around and playback worked using the provided USB cable.
- connect it to my network via wired LAN connection
* Wired setup worked using DHCP after some fiddling.
- copy files to the internal hard drive using its network attached storage drivers
* works over a proprietary network protocol (NDAS) from Ximeta (http://www.ximeta.com).
* NDAS drivers only work on Windows 98/2000/XP, but there are experimental Linux drivers on their website that I haven't yet tried.
- connect it to my wireless network
* Wireless setup worked using DHCP and access point scan (ad hoc access point attachment is also available)
* laborious WEP key input using the remote
- stream files from my main server to the MediaGate
* tricky Windows share setup was the source of a couple hours of frustration
* streaming high def content only worked using internal disk or wired connection
* dvd and lower resolution content can be streamed using wireless

Speaking of playback, here are the file formats that the MG 350HD played for me:
- DVD format MPEGs (720x480 MPEG2s with 16 bit, 48Khz stereo or MPEG1 audio) and their individual, demuxed audio/video streams
- VOB files
- DIVX
- MPEG2 TS (transport stream) HD files (720p)
- AVIs
- PNGs/JPGs
- MP3s/WAVs/WMAs/OGGs
- MPEG4s created by iTunes

It doesn't play:
- Quicktime videos
- WMVs (I need to test this more)
- Ogg/Theora videos

This is not an exhaustive list, but at least will give you an idea of file compatibility. Playlists of videos and music can be created from any of the attached devices and played back in order or shuffled. The interface to sort through your media and create playlists is basic at best and no where near as slick or as easy as an iPod. Since the interface is where you will be spending quite a bit of time, it is also unfortunate to note that it is not customizable or skinnable. Firmware updates come once per quarter or less frequently, so there will be a long wait for any enhancements to the interface.

SMB shares from Windows 2000 were easily recognized. For XP, you need an account named "guest", "media" or "administrator" with a blank password. This obviously creates a security hole. Also, I needed to assign Read privileges to the XP Guest account for the directories I wanted to share.

The most pain I experienced in the share setup was getting the device to recognize the SMB share I created on my Fedora Linux box. Lots of issues with this one:
- proper user authentication
* you need to use either an account named "guest", "media" or "administrator" with a blank password. Security hole on the systems with the shares
- lowering SELinux lockdowns for SAMBA
* select all options under SAMBA in the SELinux config utility
- appropriate file privileges
* chmod 755 on any files you want to play
- change the default SMB security level
* use a security level of "share" in the /etc/samba/smb.conf file

I had no trouble streaming high definition content from a network share using a wired connection. Using wireless I was only able to stream DVD resolution files (including MPGs and DIVx) as well as any music files without dropouts. Over wireless, strong signal strength is a must for playing back DVD resolution files without dropouts. If you're not playing back any files, the "info" button on the remote will show you the wireless signal strength. While playing back files, "info" will show you the specifications of the file being played back. Many of the buttons on the remote serve double duty depending on if you are in setup versus playback mode.

In sum, the MediaGate MG-350HD met my expectations and can playback an impressive array of video and audio files. The interface needs a -face lift, but the unit does a yeoman's job of serving up content. Definetly, you will need a wired connection or copy any high def media you have to an internal hard drive in order to view those on your HDTV via the MediaGate. Nice product.

Wednesday, November 29, 2006

very simple interpolate effect experiment

I wanted to use the interpolate effect to mimic motion, or at least generate a smooth flow between static images. I thought I might be able to use this effect for video overlays and such.

For the experiment, I used four png images, each with a green dot near the center of each image. For each image, I moved the dot a bit so that the arrangement of the four images on the Cinelerra timeline would show a circle of green dots when played back. First, I imported each still frame into a Cinelerra project formatted to 30fps and 320x180. Then, I stretched each png to the length of 30 frames using the "align cursor on frames" option and then re-added the first png image to the end of the timeline in order to complete the circle of dots. Finally, I added the interpolate effect with an "input frames per second" value of 1.

Here is the resultant video with no interpolate effect (17Kb).

Here is the video with the interpolate effect applied (38Kb).

It does mimic movement, but is not very interesting just yet. I will try to add motion blurs to enhance this.

Friday, November 10, 2006

cam compatible HDV edit chain, part II (short)

I posted a more detailed version of this two posts ago (http://crazedmuleproductions.blogspot.com/2006_10_01_archive.html), but I thought I'd reiterate it in a shorter format:
1) from Cinelerra, export video using YUV4MPEG using mpeg2enc (.m2v) compression scheme with special params:
mpeg2enc --verbose 0 --aspect 3 --format 3 --frame-rate 4 --video-bitrate 18300 --nonvideo-bitrate 384 --interlace-mode 0 --force-b-b-p --video-buffer 448 --video-norm n --keep-hf --no-constraints --sequence-header-every-gop --min-gop-size 6 --max-gop-size 6 -o %
2) from Cinelerra, export audio using mpeg audio, layer II (384Kbps)
3) multiplex audio and video streams to MPEGPS (Program Stream) format using mplex:
mplex -f 3 -b 2000 video.m2v audio.m2a -o output.ps
4) convert .ps to .ts, MPEGTS (Transport Stream) format using VLC
5) export to cam, consider using 10sec blank leader

Update 5/17/2009
Note that if you bring the video into Cinelerra and the thumbnail is green, this means that the first frame of the video is not a keyframe. This is a problem with VLC. You can avoid this problem by using this ffmpeg command in place of Step 4 above:
ffmpeg -y -i OUTPUT.ps -acodec copy -f mpegts -qscale 1 OUTPUT.m2t
*** end update ***

Update 3/14/2008
Once the video is converted, you may then output to the camera using test-mpeg2 from libiec61883:
/2006/10/success-and-failure-in-land-of-dvhdv.html

Also, take note of a possible 2GB limit in libiec61883 uploading your content to the cam:
/2006/10/libiec61883-now-exports-files-greater.html
*** end update ***

Update 11/17/06
Last night, I found that doing performing other operations on your system like surfing the web or playing audio while running mplex or VLC convert may cause problems with the video as it uploads to the camera. So don't do anything while you convert your videos.

In my case, I was 28 minutes into an hour long video uploading to the cam when the import stopped. I no longer had uploading video displayed on the LCD screen of the cam. I only saw blue, the upload seemed to continue, but I got no final output. The solution was to remux the original streams using mplex and rebuild the MPEGTS using VLC. The important point being that one of these two processes is very sensitive to fluctuations in CPU or hard drive performance. So leave your PC alone while these processes are active.
*** end update ***

That's all she wrote for today. Enjoy!
the mule

Monday, October 30, 2006

motion experiment, part III

Update 2009/03/17
I finally put together a motion stabilization tutorial. Hopefully, it helps folks who are as confused as I using the thing.
*** end update ***

The motion stabilizer is one of the most difficult effects to use in Cinelerra, as it has so many knobs and switches to figure out. It is very frustrating.

I had more luck this time with the motion effect, but it was still very hard to get working correctly. I kept playing around with different settings, but ended up using these:
- translation block around 1/6 of entire screen
- translation block more wide than high (400x150)
- track single frame
- stabilize subpixel
- zoom set to auto in compositor

Once I did get it working, I thought I did have a better feel for how the different parts interact. But the motion effect seems to be is something you have to spend a LOT of time with to get working correctly. It is still frustrating, though.

Here is the fruit of my labor:
http://content.serveftp.net/video/cinlover.mpg
Here was the original:
http://content.serveftp.net/video/cinlover2.mpg
both about 3MB

I definetly think the motion is better stabilized.

I will try to post a more detailed description of the steps I went through. Perhaps even a video, as motion stabilization is a real art. I wish it could be simplified in the software.

the mule

Sunday, October 29, 2006

rendering cam-compatible HDV MPEGTS files

I have been successful in exporting HDV back out to my cam. I haven't posted detailed output from the individual steps before, so here it is:

General Steps
1) export video from Cinelerra as mpeg2 using mpeg2enc
2) export audio from Cinelerra as mp3
3) mux in mplex
4) open MPEGPS in VLC and convert to TS.

Detail
1) export video from Cinelerra as mpeg2 using mpeg2enc:
mpeg2enc --verbose 0 --aspect 3 --format 3 --frame-rate 4 --video-bitrate 18300 --nonvideo-bitrate 384 --interlace-mode 0 --force-b-b-p --video-buffer 448 --video-norm n --keep-hf --no-constraints --sequence-header-every-gop --min-gop-size 6 --max-gop-size 6 -o /mnt/videos/20050721/20050721.m2v

2) export audio from Cinelerra as mp3:
--------------------------------------------
Input File : 'stdin' 48.0 kHz
Output File: '/mnt/videos/20050721/test.mp3'
384 kbps MPEG-1 Layer II j-stereo Psy model 1
[De-emph:Off Copyright:No Original:No CRC:Off]
[Padding:Normal Byte-swap:Off Chanswap:Off DAB:Off]
ATH adjustment 0.000000
--------------------------------------------
encode_init: using tablenum 0 with sblimit 27
Hit end of audio data
Avg slots/frame = 1152.000; b/smp = 8.00; bitrate = 384.000 kbps


3) mux in mplex
[root@computer 20050721]# mplex -f 3 -b 2000 -o test.ps test.mp3 20050721.m2v
INFO: [mplex] mplex version 1.8.0 (2.2.4 $Date: 2005/08/28 17:50:54 $)
INFO: [mplex] File test.mp3 looks like an MPEG Audio stream.
INFO: [mplex] File 20050721.m2v looks like an MPEG Video stream.
INFO: [mplex] Found 1 audio streams and 1 video streams
INFO: [mplex] Selecting generic MPEG2 output profile
INFO: [mplex] Multiplexing video program stream!
INFO: [mplex] Scanning for header info: Audio stream c0 (test.mp3)
INFO: [mplex] MPEG AUDIO STREAM: c0
INFO: [mplex] Audio version : 1.0
INFO: [mplex] Layer : 2
INFO: [mplex] CRC checksums : no
INFO: [mplex] Bit rate : 49152 bytes/sec (384 kbit/sec)
INFO: [mplex] Frequency : 48000 Hz
INFO: [mplex] Mode : 0 stereo
INFO: [mplex] Mode extension : 0
INFO: [mplex] Copyright bit : 0 no copyright
INFO: [mplex] Original/Copy : 0 copy
INFO: [mplex] Emphasis : 0 none
INFO: [mplex] Scanning for header info: Video stream e0 (20050721.m2v)
INFO: [mplex] VIDEO STREAM: e0
INFO: [mplex] Frame width : 1280
INFO: [mplex] Frame height : 720
INFO: [mplex] Aspect ratio : 16:9 display
INFO: [mplex] Picture rate : 29.970 frames/sec
INFO: [mplex] Bit rate : 18300000 bits/sec
INFO: [mplex] Vbv buffer size : 229376 bytes
INFO: [mplex] CSPF : 0
INFO: [mplex] SYSTEMS/PROGRAM stream:
INFO: [mplex] rough-guess multiplexed stream data rate : 19077648
INFO: [mplex] Setting best-guess data rate.
INFO: [mplex] Run-in Sectors = 752 Video delay = 58123 Audio delay = 61126
INFO: [mplex] New sequence commences...
INFO: [mplex] Audio c0: buf= 0 frame=000000 sector=00000000
INFO: [mplex] Video e0: buf= 0 frame=000000 sector=00000000
INFO: [mplex] Scanned to end AU 39469
INFO: [mplex] STREAM e0 completed @ frame 39469.
INFO: [mplex] STREAM c0 completed @ frame 54874.
INFO: [mplex] Multiplex completion at SCR=118584775.
INFO: [mplex] Audio c0: buf= 2304 frame=054874 sector=00031342
INFO: [mplex] Video e0: buf= 0 frame=054843 sector=00509538
INFO: [mplex] AUDIO_STATISTICS: c0
INFO: [mplex] Audio stream length 63216000 bytes.
INFO: [mplex] Syncwords : 54875
INFO: [mplex] Frames : 54875 padded
INFO: [mplex] Frames : 0 unpadded
INFO: [mplex] BUFFERING min 18 Buf max 1169
INFO: [mplex] VIDEO_STATISTICS: e0
INFO: [mplex] Video Stream length: 1031417371 bytes
INFO: [mplex] Sequence headers: 6579
INFO: [mplex] Sequence ends : 1
INFO: [mplex] No. Pictures : 39470
INFO: [mplex] No. Groups : 6579
INFO: [mplex] No. I Frames : 6579 avg. size 58215 bytes
INFO: [mplex] No. P Frames : 32891 avg. size 19714 bytes
INFO: [mplex] No. B Frames : 0 avg. size 0 bytes
INFO: [mplex] Average bit-rate : 6264800 bits/sec
INFO: [mplex] Peak bit-rate : 9203600 bits/sec
INFO: [mplex] BUFFERING min 943996 Buf max 1944874
INFO: [mplex] MUX STATUS: no under-runs detected.
[root@computer 20050721]#



4) open MPEGPS in VLC and convert to MPEGTS.

Update 3/14/2008
Once the video is converted, you may then output to the camera using test-mpeg2 from libiec61883:

/2006/10/success-and-failure-in-land-of-dvhdv.html

Also, take note of a possible 2GB limit in libiec61883 uploading your content to the cam:
/2006/10/libiec61883-now-exports-files-greater.html

Saturday, October 28, 2006

libiec61883 now exports files greater than 2GB to cam!

As you may know, I've been successful in rendering HDV MPEGTS that works being output back to my cam. However, I stumbled upon the fact that libiec61883 cannot output files greater than 2GB. Well, I rolled back my operating system to an earlier image, rebuild libiec61883 with the -D_FILE_OFFSET_BITS=64 DEPS param in examples/Makefile and now I can send data greater than 2GB using the command
[scf@localhost ~]# test-mpeg2 -t 0 file.m2t
where 0 is the physical id of the cam as specified by gscanbus

I have found that using the incorrect physical id will result in the following error message:
[scf@localhost ~]# test-mpeg2 -t 1 file.m2t libiec61883 warning: No plugs exist on either node; using default broadcast channel 63.

However, the camera will still display the incoming video. If the physical id is correctly specified, you should see no errors and the "Starting to transmit.." message only:
[scf@localhost ~]# test-mpeg2 -t 0 file.m2t
Starting to transmit

I have no idea why this fixed the problem, because I used the same steps as before. Just glad it works.

Saturday, October 21, 2006

basic OpenGL vs XV performance stats

Thought I'd share some Cinelerra performance stats using OpenGL versus non-OpenGL (XV) display drivers. I used two tracks of identical length (32s), but different content.

OpenGL
one 32s 720P track: 20fps
two 32s 720P tracks, both play enabled, no fade on top track: 2.97fps
two 32s 720P tracks, both play enabled, 50% fade on top track: 3.04fps

Stopped then restarted Cinelerra and performed next test.

XV
one 32s 720P track: 10.6fps
two 32s 720P tracks, both play enabled, no fade on top track: 2.2fps
two 32s 720P tracks, both play enabled, 50% fade on top track: 2.18fps

Not fabulous performance for using > 1 track, but still slight improvement over XV.

Thursday, October 19, 2006

motion experiment, part II

Update 2009/03/17
I finally put together a motion stabilization tutorial. Hopefully, it helps folks who are as confused as I using the thing.
*** end update ***

I was able to get a better result from the video I made a while back. I realized I did not use the "Previous Frame Same Block" option originally. This made a huge difference. As I didn't have much time to fuss with it, I lowered the translation search steps to 128 as you suggest.

Here are my results with comparison of before, after and zoom. The video is very compressed, but you can see that the zoom doesn't degrade too badly, as my source is HDV, which is something you'd be interested in seeing:
http://content.serveftp.net/video/motionexercise.m2v
7MB

Here's the next in the series:
/2006/10/motion-experiment-part-iii.html

HDV MPEG2 transport stream file sizes/render rates

The data rate of the 720P MPEG2-TS files output from my cam is about 108.95MB/min or 1.82MB/s. Here is a table of video length-to-size conversions.

duration size

12m 1.32GB
15m 1.65GB
18m35s 2.07GB
19m12s 2.12GB
20m01s 2.18GB
34m 3.70GB
Exporting 720P HDV from Cinelerra takes two processes:
1) render the video
2) render the audio

Here are some rendering times using mpeg2enc and mpeg layer 2 audio compression:

duration mpeg2enc render rate
63m 310m 4.92min per min of video

duration mp2 render rate
63m 6m 0.09min per min of audio

Mplex takes about 7 minutes to mux about an hour of audio and video.

Monday, October 16, 2006

hard work is paying off / HDV workflow

OK! I've got the latest video up on iTunes and now I just need to edit the XML for it. Editing the damn XML always takes too long. And of course, I want to get the track list right with the correct track times and witty comments. Ufff. OK! So the track list is done and now to send the boys the email for the latest video! Hurrah!

More for my benefit than anyone elses, here is my HDV workflow using Cinelerra:
1) import video
2) edit video
3) for multiple segments, make sure you set "align to frames" and audio and video segments end at the exact same time.
4) for HD output, render using mpeg2enc settings
5) for DVD output, render using ffmpeg -target DVD from Cinelerra, something like this:
ffmpeg -f yuv4mpegpipe -i - -y -i /mnt/videos/20050721/20050721.wav -target dvd %
6) for iPod output, render using ffmpeg -target DVD, then output to mpeg4 video/aac audio mov container:
ffmpeg -i inputdvd.mpg -f mov -vcodec mpeg4 -qscale 7 -s 320x180 -r 29.97 -aspect 16:9 -acodec aac -ac 2 -ab 128 output.mov
7) import .mov to XP iTunes
8) upload .mov to website
9) edit RSS XML
10) final test in iTunes

trials of Cinelerra rendering, deja vu all over again

Well, four hours of overnight rendering yields a video I can't playback. I get this error:
int YUVStream::read_header(): y4m_read_stream_header() failed: bad header magic
int YUVStream::open_read(char*): Bad YUV4MPEG2 header: parameter out of range


Now what the F is wrong? Is it a problem with:
- my rendering options I chose?
- this version of ffmpeg in general?
- my project?

I wasted a number of hours on the first two possibilities. I finally saw two issues in my project:
1) for some reason, probably my big fat fingers, an audio transition was placed right at the beginning of the project (Timecode 00:00:00). I deleted this.
2) I noticed that for joins between separate videos on the same a/v tracks, the joins between the audio and video segments did not end at the exact same place:
http://content.serveftp.net/video/avmisaligned.png

To stop this, I went to the end of each segment, zoomed in all the way, and made sure that each video and audio segment ended at the exact same time. If they didn't end at the exact same time, I clipped off a bit of whatever audio or video track is dangling by using the mark in/mark out indicators and doing a "cut". After doing the cut, the segments aligned perfectly.
Even with these changes, however, I still get a similar version of my original error when I load the project:
int YUVStream::read_header(): y4m_read_stream_header() failed: bad stream or frame header
int YUVStream::open_read(char*): Bad YUV4MPEG2 header: parameter out of range
However, I can output it to a usable format, so I don't mind the rather ugly error messages. You'd thought I would have known better by now. ARGH!

Along the way tonight, I've been trying to help the Cinelerra CVS community debug a couple of errors:
1) the intermittent project hangs
2) MS MPEG4 render crashes

I synchronized my hvirtual directory twice and recompiled, once for v932 for the project hang problem and then v940 for the MS MPEG4 render crashes. Both took a couple interations, but it seems like the programmers have the problems licked. That's good. We've been pushing them pretty hard lately.

So, finally around 11pm, I've rendered the video to a usable DVD mpg. Now it's time to render once more; this time to iPod format. It looks like FFMPEG has removed the "-b" bitrate switch in favor of some quality scale switch, "-qscale". The higher the qscale, the lower the quality. To create videos with the same quality as the original, you can use the "-sameq" switch. Otherwise, a qscale of 4 will yield a decent quality video with some significant compression. I'd use h264, but I haven't been able to install it successfully. I may try VLC..

Update 2009/06/09
My understanding of the "-sameq" switch was a little naive. Robert Swain enlightens here:
http://rob.opendot.cl/index.php/2009/05/01/bit-rate-file-size-quality-misunderstandings/

You'll probably need to read it a couple of times like I did.
:)
*** end update ***

Saturday, October 14, 2006

outstanding bugs/foul ups/frustration

There were a number of outstanding bugs that some of the cvs.cinelerra.org programmers addressed. One of them was that Cinelerra keeps hanging when I open up projects. It seems to happen on projects I've built before 2.1 that I've saved as 2.1. So I've told the programmers I will test their work once they apply the patches. I drank too much coffee in the afternoon and deleted a number of files that I wish I hadn't off of my FAT partition. Stupid ass. Luckily, I have those on a second drive, so I should be OK. Another thing to do: MAKE DVD BACKUPs OF PARTITION IMAGES, PRONTO!! Ugh. What a hassle. This new rig is NOT making my life any easier!!

Tonight, I finally got to edit some video..the last band video. Amazing! It has been about a month and a half since I started the whole OpenGL/export HDV to tape excursion and while I've learned a lot, it has just been frustrating as hell. The state of HDV on Linux is pretty rough. I'm lucky I've made it this far and I wouldn't have without the help of the community, both cvs.cinelerra.org and linux1394.org. I'd like to finish this edit job so that I can spend some time with my girlfriend before she leaves me. As I'm editing this video, I'm a little upset by the quality: the crappy automatic gain control on the cam makes dark shots look grainy and grey and the focus fades in and out. How good of a video production will I make if the camera work sucks? Yarg. At least I've finished the edits. Off to render!

Friday, October 13, 2006

editing rig is 95% there

My editing rig is 95% there, outside of not having the ability to render using h264. Also, I'm only able to export files greater than 2GB to tape. Apparently, this is a typical problem that should be resolved by using some compiler flags (-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE). However, the compiler flags did not work, so I was just reading up on this thread: http://www.google.com/search?hl=en&q=reading+files+larger+than+2gb+cflags+D_LARGEFILE_SOURCE

that states that my system needs to support the following calls: mmap64, sendfile64, sendfilev64, mkstemp64. I will also try to pass --enable-lfs to configure.

Thursday, October 12, 2006

VLC install

If cinelerra source dependencies are already installed, VLC requires the following files to be compiled:
- ffmpeg-devel
- fribidi
- libdvbpsi
- libiec61883/libraw1394
- libmad
- libtheora
- mpeg2dec
- twolame
- wxGTK (special build: buildgtk)
- gettext-devel

And then of course, VLC itself (special build: ./bootstrap)

Download the 77MB source files from http://www.videolan.org

Wednesday, October 11, 2006

exporting HD content to the cam: IT IS ALIIIIVE!! ALIVE!!

After a month of testing and experimentation with many inter-OS softwares, exporting HD content to my camera is working! YAHOO!! The greatest part is..I am Microsoft FREE!

Most of my work was based off of this original thread:
http://www.dvinfo.net/conf/archive/index.php/t-19007.html

But a number of steps (ffmpeg/DVHSCap) did not work for me.

Here are the steps I used to get HD content from Cinelerra back to my cam in full resolution, HD 720P format:

1) install the latest 2.6.18 kernel according to specs on http://www.linux1394.org
2) you'll need the latest libiec61883 and libraw1394 libraries from the same place . I needed to manually tweak the ./configure procedure for libiec61883 with the following environment variable:
PKG_CONFIG_PATH=/usr/local/lib/pkconfig
Another caveat to this step is that I needed to remove libraw1394 first, which was a nightmare because of all its dependencies. I created a yum install script to reinstall everything after this was complete.
3) you'll need to make a change to tsbuffer.c and recompile libiec61883 (don't have it now..email me if you need it).
4) you'll need to recompile mpeg2enc to allow for bitrates larger than 14000. This is referenced in the thread from way back when:
http://www.dvinfo.net/conf/archive/index.php/t-19007.html
--------------------
A kludgy hack allowed me to get bit rates higher than 15Mbs in mpeg2enc

I removed the following lines from conform.cc
if (bit_rate> 1.0e6 * maxval->bit_rate)
mjpeg_error_exit1("Bit rate is greater than permitted in specified Level");
---------------------
5) here are the mpeg2enc switches that were successful for me:
mpeg2enc --verbose 0 --aspect 3 --format 3 --frame-rate 4 --video-bitrate 18300 --nonvideo-bitrate 384 --interlace-mode 0 --force-b-b-p --video-buffer 448 --video-norm n --keep-hf --no-constraints --sequence-header-every-gop --min-gop-size 6 --max-gop-size 6 -o mpeg2.mpv
6) mplex params:
mplex -f 3 -b 2000 -o programstream.ps audio.mp2 mpeg2.mpv
7) Use VLC to convert the file to a transport stream. By the way, the VLC is a hellish snake pit of install dependencies. Go to http://www.videolan.org to download the latest source.

Here are the instructions for VLC from Paul St. Denis' original steps (http://www.celt.sunysb.edu/paul/mpeg2enc_HDTV.zip):
------------------
Start VLC, from the "file" menu select "open file", click on the "Browse..." button and find "programstream.ps", check on the "advanced output" check box and then click on the "Settings.." button. Make sure the "file" radio button is picked click on the "Browse..." button save the file on your desktop as "transport.ts".

Make sure that the "Encapsulation Method" is MPEG TS, leave everything else blank. Click OK, which brings you back to the other screen click OK again.
------------------

Yes, it's a lot of work. But to be Microsoft free is a great feeling.

Update: as of this writing (10/17), I'm only able to upload less than 2GB of video. For my 720P video cam, this is about 19.7 minutes of video. I am working with the linux1394 community to resolve this.

Saturday, October 07, 2006

success and failure exporting/importing video to/from camera

I should say that those notes are for HDV content, but some of them are
applicable for regular DV.

Today I spent some time with folks on the Cinelerra IRC channel trying to hook up my HDV cam for import and export functions. I used a combination of three programs: dvgrab to import/export DV content and test-mpeg2 (from libiec61883 source) or mpg1394grab for HDV export/import.

"mpg1394grab" (sorry for the typo) is used to capture IEC61883 streams to MPEG2TS format. Here is some more detail about it:
http://www.kinodv.org/article/view/54/1/11

The results were as following:

            import tape  import live stream  export file to cam
dvgrab not tested works does not work
test-mpeg2 works works sometimes does not work
mpg1394grab works works n/a

Notes:
mpg1394grab works better for grabbing HDV.
test-mpeg2 import command is "test-mpeg2 -r [node] [file]"
test-mpeg2 export command is "test-mpeg2 -t [node] [file]"

On my Fedora Core 4 system, I have a /dev/raw/raw1394 instead of a /dev/raw1394. I don't know why.

Make sure there is a symbolic link to /dev/raw1394:
ln -s /dev/raw/raw1394 /dev/raw1394

Make sure the driver is chmod 666:
chmod 666 /dev/raw/raw1394

To compile mpg1394grab, execute this:
gcc -lraw1394 mpg1394grab.c -o mpg1394grab

My camera is the JVCHD10U. In the onboard menu system of the camera, you can change the iLink Out setting to either SW (software) or AUTO (automatic). The JVC must be set to AUTO for Linux to recognize the cam. This is different than XP, which requires the camera setting to be SW.

For dvgrab, the camera must be set to DV/DV
For mpg1394grab and test-mpeg2, the camera must be set to MPEG2/HD

seeing my cam in Linux

The troubleshooting steps here helped me out quite a bit. In short:
1) make sure you have libraw1394
2) make sure there is a link to /dev/raw1394
3) download the latest kernel (http://www.mjmwired.net/resources/mjm-kernel-fc4.html
4) make sure to select Code Maturity Options (Prompt for developement drivers) and enable IEEE 1394, OHCI 1394, and Raw 1394 support options
5) make sure new kernel sees firewire interfaces (dmesg grep 1394)
5) load the modules (modprobe ohci1394 (the firewire card)/modprobe raw1394 (interface to it))
6) check that the modoules are there (lsmod)
7) use testlibraw
8) use gscanbus

This should do it!

Wednesday, October 04, 2006

trying to get HDV content back out to my cam..

Lest ye think I have been sitting on my very small, small laurels, I want all the open source, JVC HD10U fans out there know that I am still working the problem. However, I have almost given up as a result of my many trials and tribulations over the past five days with MPEGTS file formats and the JVC cam.

My journey started here:
http://www.dvinfo.net/conf/archive/index.php/t-19007.html

I replicated all of the steps; however, the last step I cannot reproduce because I don't have an Apple Mac. I've tried exporting the .ts file to the cam using DVHSTool, CapDVHS and the utility that comes with the cam, but all of them give me errors. I've tested against many different versions of outputted files with little success. My last hope is that I can get a virtual Mac going using Xen, download DVHSCap to it and then try DVHSCap on the file.

say a prayer..cross your fingers..

Sunday, October 01, 2006

JVC HD10U specs

Really good doc on the MPEG format utilized by the JVC HD10U:
http://www.gyhduser.com/article.php?filename=What-is-HDV-

Sunday, September 24, 2006

title sequence for birthday video complete..

Between writing doc to help myself and others on the Cinelerra list, I've finally produced some usable output. Check out my birthday video intro titles:
1.5MB

This is an mpeg4 quicktime vid. Mplayer/Xine should play it fine.

zoomed title

Well, this took way too long to do. Again with projector automation and manipulation of bezier curves. But, I figured I'd try it anyway. Nice little zoomed title
670K

Thursday, September 21, 2006

first split screen..

I used the projector and camera automation to do my first split screen today:
split.mpg
670K

Wednesday, September 20, 2006

digging that Batch Render capability!

Since I wrote that document regarding Cinelerra's QT for Linux compatibility, Cin's batch rendering came in quite handy.

Things to watch out for:
1) make sure your output path is not only the directory, but the destination filename as well
2) clicking New will add that render to the list. Now you can highlight the batch item and tweak its settings (file format/audio/video/batch enabling) if need be.
3) make sure to Save List to save out the batch. Inevitably, you'll make a mistake the first time you setup a batch. So it's important to be able to reload it if Cinelerra crashes or you've forgotten something.




Here is an updated discussion of the batch render feature:
http://crazedmuleproductions.blogspot.com/2010/01/batch-render-redux.html

the mule

Monday, September 18, 2006

Quicktime for Linux compatibility chart

I spent Sunday afternoon and evening creating this compatibility chart for QT for Linux formatted files exported from Cinelerra. There are many compression schemes that can be used within this file format and I did not have a list to tell me what scheme works and what doesn't in Cinelerra and some default media players like Mplayer, Quicktime for Win and Windows Media Player 10. Hence the guide.

Enjoy!
html format
open office calc format

Friday, September 15, 2006

upgraded video workstation has arrived!

My video rig is finally ready to go! After one month of hardware and software upgrades, I'm ready to start editing. Here are the upgrades I did:
- from 1GB non-ECC, Dual DDR to 2GB ECC Dual DDR mem
- from a system and a content drive to a system and RAID0 content drive
- from a 128MB ATI video card to a 512MB NVidia video card
- from non-OpenGL to OpenGL editing software

Update (9/19): converted my old 80GB dual-boot XP/Core 4 system drive to shiny new 250GB SATA w/16MB cache! Took about seven hours to backup the filesystems, partition the new drive and restore, with a few lessons learned along the way. Here's how this went:
http://cacasodo.blogspot.com/2006/09/replacing-old-dual-boot-system-drive.html

So, we're ready to go with da editing! Hooray!!

Install notes:
- FC4 install
- fstab/ntfs kernel module/NVidia drivers/xorg.conf/mdadm.conf/rpmkeys/remove libdv/install libdv4
- libdvDeps.sh
- install cinelerra
- cinSourceDeps.sh
- create /mnt/win, /mnt/nt
- window prefs/google/cin window placemnet/save on exit

rebuilding the workstation: lost my damn RAID set!

I *almost* had a minor tragedy last night while rebuilding my Fedora Core 4 box. The *almost* tragedy occurred while reinstalling Core 4. While going through the process, I told the installer to use my existing RAID set, but do not reformat it. I figured what harm could come to the drive if it doesn't get formatted? Well, a lot, apparently. Since I was rushing through the install, I neglected to take proper care of the 40GB of MPEG2 files on the RAID set. Here's what happened.

After the FC installer finished, it asks to reboot the box, so I rebooted. On bootup, the system gave me errors regarding an unrecognized filesystem and dropped me to a filesystem shell to fix what was wrong. I didn't know what was wrong, so I rebooted into a linux rescue disk and simply took the RAID filesystem out of /etc/fstab and rebooted.

On the second bootup, I started fdisk to look at the drives. To my dismay, fdisk did not recognize the RAID set partitions. Agh! I did some preliminary research online. I came to the determination that I figured I had lost my data, though I did have it backed up. But it would be a pain to retrieve the 40GB or so of videos from my backup system. Damn it. So I bit the bullet and created new partitions of type "fd", a Linux RAID autodetect partition as I had done when I setup the RAID set initially. When I wrote the partition table, fdisk gave me some error saying that the drives will resync after the box reboots. I rebooted and looked at the output of "fdisk -l". Things seemed alright, as the drives were recognized as Linux RAID autodetect. So I then reenabled /dev/md0 in /etc/fstab and made sure that /etc/mdadm.conf was correct. Dejectedly I rebooted.

When the system started, it dropped me into a prompt complaining of filesystem problems again. Now what? This time, I looked at the man pages for fsck and figured out the commands I needed to repair the disk. They ran something like this:
fsck -t ext2 /dev/md0 -V -r
-t filesystem type
-V verbose
-r prompt for each repair


A couple of inodes were missing or corrupt. OK. Fsck seemed to continue on with the different stages of the five stage check procedure. About five or ten minutes of this, I was getting worried. Happily, it finished the checks and dropped me to a prompt in order to exit and reboot. OK..that's progress! Also, the box came up clean with no errors. Sweet. I now went to view the filesystem, and to my shock and surprise, my original files were there! Awesome!! But now the real test is reading from and writing to files. I first viewed one of the videos in mplayer. This worked! I then performed an extensive write test. Cinelerra needs table of contents files for each video. These are index file, essentially. So at a prompt, I generated a bunch of toc files for the 30GB or so of video I had by using this one command:
for i in `ls -1 *.m2t` ; do echo $i ; mpeg3toc $i $i.toc ; done

The file creation took about twenty minutes but worked! I then loaded the files into Cinelerra, started editing and wouldn't you know they are good to go! Hooray! But I'm still an idiot.

Moral of the story is make sure you do your research on RAID before you decide to implement it.

Wednesday, September 13, 2006

ATI OpenGL 2.0 implementation incomplete..hello NVidia!

Sad to say, but all you ATI lovers (like I USED to be) are in for a rude surprise with ATIs' "OpenGL2.0" Linux driver implementation. After 1 1/2 days of finally getting my ATI All in Wonder 9800 Pro to actually use Direct Rendering and OpenGL2.0 and see it working well (5000FPS on glxgears), it was very disheartening to find out that ATI had not provided the proper 2.0 hooks for Cinelerra to use. Specifically, programming hooks like glDeleteShader were not implemented. The troubleshooting was quite informative, as I am not an active C programmer.

The solution was typical of today's PC market. If it don't work, buy one that does! So I went to B&H Photo and bought a BFG nVidia GeForce 7600GS, 512MB. Twenty minutes after getting home, the card was in the box, drivers were compiled, installed and working. Fifteen minutes after that, Cinelerra was compiled and I was using OpenGL2.0! Yeehoo!! And at twice the playback speed of what I was getting previously with the ATI card. I will report back on the performance of this card once I actually USE it.

Tuesday, September 12, 2006

openGL acceleration for Cinelerra not working just yet

Well, I spent all Sunday and Monday reconfiguring my workstation for hardware rendering (as detailed here), but my recompile of the latest Cinelerra code blew up on some obscure header file. Hopefully, the smart fellows on http://cvs.cinelerra.org can help out.

Wednesday, September 06, 2006

tracing a specific path using camera automation

For my Paris video, I wanted to simulate our walk of the city by panning an old map of Paris highlighted with the streets we traveled. To do this, I imported a series of large (2800x2100) still images created in Gimp and used camera automation to simulate movement. The camera automation needed to be very specific to trace our path. Thus, I had to get the X,Y coordinate pairs of each point I wanted the camera to center upon. The hurdle I encountered is that the origin of the X,Y coordinate system used in Gimp is at the upper-left hand corner of the image, whereas the origin of an image or video imported into Cinelerra is at the center of the image. So I had to do a conversion.

For an image that is 2800x2100:
(0,0) in Gimp is (-1400,-1050) in Cinelerra
(1400,1050) in Gimp is (0,0) in Cinelerra
(2800,2100) in Gimp is (1400,1050) in Cinelerra

Hence, in Gimp, all X/Y values are positive, but in Cinelerra, X and Y can have negative values.

Most of the camera automations to simulate our walk required about four coordinate pairs; hence, four conversions:
1) origin
2) first leg of walk
3) second leg of walk
4) destination

As you can see, when I wanted to change the speed or direction of the pan, the conversion of coordinates got a bit tedious. Also, I varied the movement of some of the camera automations so that not all were bezier curves, but more linear. As noted in an earlier post, this can be accomplished by displaying the X and Y camera positions and using CTRL-click on the vertices to "pull" the curves straight. This takes a little getting used to and is very time consuming. Note that there will be two sets of "pull" vertices on either side of the actual X/Y positions that you can adjust to straighten the curve slope.

But the result is quite pleasing:
ParisRoutes
55MB

Saturday, September 02, 2006

outputting HDV from Cinelerra

Update 9/10/06:
This procedure doesn't work. The working one is listed here:
/2006/11/cam-compatible-hdv-edit-chain-part-ii.html

Do it with FFMPEG:

Audio and Video Mux Example:
ffmpeg -i jpegphoto.mov -f mpegts -vcodec mpeg2video -aspect 1.777 -b 18300 -r 29.97 -s 1280x720 -acodec mp2 -ac 2 -ab 384 -ar 48000 output.m2t

Container/File Format:
-f mpegts

Video
-vcodec mpeg2video
-aspect 1.777
-b 18300
-r 29.97
-s 1280x720

Audio
-acodec mp2
-ac 2
-ab 384
-ar 48000