Sunday, December 27, 2009

ffmpeg - MTS to MOV with DNxHD

So I'm trying to get some insane high quality .MTS video, down to the same quality as my DSC's .MP4 stuff in DNxHD.

I can't for the life of me convince ffmpeg to get the FPS right. So for now my solution is NOT to take it to DNxHD, but to MJPEG

The video is easier than the sound - due to Vegas having that stupid sound bug. I spent more than an hour today trying to find an audio stream that Vegas likes. So far I have this:

ffmpeg -i source.MTS -vcodec mjpeg -s 1280x720 -qscale 1 -r 30 -acodec ac3 -ac 2 -ab 192k -ar 44100 target.AVI

Video works sweet - sound still messed up!


Thursday, December 24, 2009

Sony Vegas - it's worth the trouble to get it to work

After battling for hours - I have the solution.

Problem: Sony Vegas won't play audio for .MP4 - they blame QuickTime (LAME!!). All other non-pro video editors suck. Apart from the ones I blogged about - I tried a whole bunch of open source ones. They all suck.

Solution:
1. Pay for Sony Vegas (incentive to get it to work + I'm a Sony whore even though their laptops suck)
2. Download DNxHD codec from Avid woohoo for open standards!
3. Set up a nice Ubuntu install in VirtualBox (I'll have to dual boot until Civilization and Vegas run native under Linux.) Skip this step if you are hard core enough to compile ffmpeg to work under Windows.
4. Praise the mighty ffmpeg

ffmpeg -i INPUT.MP4 -vcodec dnxhd -b 60Mb -acodec pcm_s16be OUTPUT.MOV

5. Boom. You're ready!!!


Tuesday, December 22, 2009

Video Editing - With Adobe Premier Elements 8

Awesome i7 chip, 7200rpm drive is decent enough - lets give this a spin

1) Massive download, install Adobe Premier Elements 8
2) Woohoo! It can edit .MP4 files!!!
3) Ok. It stopped working. W.T.F???
3.1) Damnit! Fine - I'm learning how to use ffmpeg
3.2) Install ubuntu in virtualbox - I'm not rebooting all the time
3.3) ffmpeg -i M4H00471.MP4 -vcodec mjpeg -sameq output.avi
4) Ok - sweet - I can open my files
4.1) I wonder if it works in Vegas now?
4.1.1) Nope
5) Ok - lets do some easy fade in / fade out effects
5.1) Damn this shit is slow.
5.2) DAMN!!! THIS IS SLOW!!!
5.3) W.T.F? It's not even touching my processor! My machine is just sitting back and relaxing!
5.3.1) Lots of free memory also... hmmm...
5.4) Ok ok - maybe I need to defrag?
5.5) Still slow as all hell.

Come on!!! How hard can this be! I just want to edit some some video mp4 video from my little digital camera. 720p 30 - that's not even a crazy high resolution. It should be a dream!

Sunday, December 06, 2009

Video Editing - With Kdenlive

New laptop with Ubuntu Karmic Koala. Time to edit those holiday videos.

1) Hello Kdenlive. Ok.. lets load in all the clips... BOOM CRASH.
2) Ok. Let's try only one. Hmm... sound playback kinda broken. Let's drag it on anyway. BOOM CRASH.

SOD THIS!

Video Editing - With Sony Vegas Platinum 9.0

New laptop with Windows 7. Time to edit those holiday videos.

1) After messing around and trying to figure out what I was doing wrong.... No sound? Oh excuse me - mp4 from my Sony DVC doesn't provide a understandable audio track?
1.1) Ok - I'll convert it to something else
1.1.1) To VLC!
1.1.1.1) .OGG maybe? .OGG with VLC - bad quality, and sound is skippy. And Vegas can't play it.
1.1.1.2) .ASF then. Blegh. I think VLC is a bit ill.
1.1.2) Sod VLF - there must be something else! Ooow how about handbrake?
1.1.2.1) Nope - only for transcoding to nice little happy viewable formats.
1.1.3) MediaCoder?
1.1.3.1) Need 7zip to extract
1.1.3.2) Error code 8? That doesn't help me!

Forget this!!! I'm booting back into ubuntu!

Monday, November 23, 2009

xkill

alt-f2 xkill

killing those nasty applications that i make...

Monday, October 19, 2009

WPF and the modal dialog (boring)

Warning boring tech related blog entry follows:

Holy cows! WPF has made it VERY difficult to create a modal dialog box. It's difficult, because to do it properly, your modal dialog has to have a pointer to it's parent window. You can skip this step, have have one of those really junky applications that hide away your modal dialog in a land far far away.

The trick (hack) is the following

1) You need a System.IntPtr containing a pointer to the windows handle (this.Handle if you are lucky enough to be in a System.Windows.Window.Form)

2) You need to feed this pointer into your dialog thusly:

WindowInteropHelper wih = new WindowInteropHelper(myUserControl);
wuh.Owner = myIntPtr;
// then, with magical flair:
myUserControl.ShowDialog();

Tuesday, October 13, 2009

log4net

I keep forgetting how to switch on log4net (using app.config)

I always end up wasting time on the apache docs, and searching the net to find this

Step 0:
Ensure that the first declaration of
"private static readonly log4net.ILog Log =log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);"
Occurs in your main assembly - if the first declaration is in linked assemblies, it won't load the setting correctly.


Step 1: Edit AssemblyInfo.cs
[assembly: log4net.Config.XmlConfigurator(Watch = true)]

Step 2: Edit App.config
Important! The configSections bit has to be at the top of your config file. So if you've got an existing one, don't just add it on to the end!

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections>
<log4net>
<appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender" >
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger [%ndc] - %message%newline" />
</layout>
</appender>
<root>
<level value="INFO" />
<appender-ref ref="ConsoleAppender" />
</root>
</log4net>
</configuration>

Step 3:

Wednesday, August 26, 2009

"enfuse - poor man's HDR"

Maybe I'm just too lazy for HDR.

I think align_image_stack and enfuse are my new best friends.

Thursday, February 26, 2009

XML, DOM, JAVA

One of those things that I never bother remembering the exact details of, but end up having to look up on the internet all the time.

Note to self: XML, DOM, JAVA
Taken from this guys site: http://www.genedavis.com/library/xml/java_dom_xml_creation.jsp
Also a bit from here: http://www.java-tips.org/java-se-tips/javax.xml.parsers/how-to-read-xml-file-in-java.html

// get dom doc
DocumentBuilderFactory dbfac = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = dbfac.newDocumentBuilder();
Document doc = docBuilder.newDocument();
// Document doc = docBuilder.parse(new File(inputFilename));

// -- insert building dom here

// get dom transformer
TransformerFactory transfac = TransformerFactory.newInstance();
Transformer trans = transfac.newTransformer();
// make dom into something useful
FileWriter fw = new FileWriter(new File(outputFilename));
StreamResult result = new StreamResult(fw);
DOMSource source = new DOMSource(doc);
trans.transform(source, result);