Showing posts with label itunes. Show all posts
Showing posts with label itunes. Show all posts

Saturday, October 04, 2008

iTunes/iPod video workflow, scripted

I am going to revisit my conversation about workflow. Here's what we briefly discussed:
- the transformation of an idea (video) into reality and distributing it (in this case, using iTunes)

With today's internet, the steps involved are broad-based:
- idea creation, storyboard, distribution, production, archiving, marketing

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

I shall give you an example and how I reduced the amount of time spent creating and distributing my content.

When not working, my world is playing music with a band of itinerant musicians called the StormPigs. We gather together once every couple of months to play freeform music. No prior thought involved, just play. The joy of this is being together and having a good time. Otherwise, we are all busy professionals with full-time jobs and families. In remembrance of that good time, I produce videos of the event, distributed via iTunes and YouTube.

As time seems compressed these days, I want to spend as little time as possible behind the keyboard (though I am a technologist by trade). And as readers of this blog know, I am avid proponent of Linux. The beauty of Linux is that the system is completely configurable and flexible. But with this power comes a price. You have to invest the time to learn the shell, some bits of scripting and other Linux arcana. Consequently, it is daunting to the newcomer. But the benefits return to you many times over, as time you once spent on minutiae can now be spent thinking of new ideas for shows and creating new content, rather than simply focusing on the details of getting a file up to the server or copy and pasting content from one application to the other.

I am not a programmer of fanciful GUI front ends. I am a guy who just needs to get work done. So I try to solve my problems in the simplest way possible using the Linux programs and bash shell scripts to tie multiple programs together.

Here is the latest problem I needed to solve:
- how to I get my videos onto the web and in an iTunes ready form as quickly as possible?

In that light, I have come up with some scripts to help me on my way:
- the first encodes my editing video project into various formats (HDV, DVD, podcast)
- the second creates the list of songs from the video that will go into the podcast
- the third merges that songlist information into the podcast
- the fourth creates a new iTunes RSS feed (XML file) from the songlist information
- the fifth uploads the new podcast to my webserver
- the last is a wrapper that starts the other five

The encoding script is most useful and is the basis for the others. This script takes 720P video and 48Khz MPEG, Layer II stereo audio output rendered from a Cinelerra project and converts it to various formats: MPEG2 Program Stream, HDV, DVD and iTunes/iPod compatible formats. You will need the following programs installed for this script to work:
-mplex
-vlc
-ffmpeg

I've found the quality of each output file to be very good to excellent.

You can wrap some validation and input around this script, but the guts of the script look like this, where the arguments enclosed in curly braces will be replaced by the names of your input and output files:
#!/bin/bash
echo "Input: M2A audio and MPEG2 720P video streams"

echo "Output: program stream"
mplex -f 3 -b 2000 ${AUDIO} ${VIDEO} -o ${PS}

echo "Input: program stream"
echo "Output: MPEG2-TS, HDV"
vlc ${PS} --sout '#duplicate{dst=std{access=file,mux=ts,dst="'${HDV}'"}}' vlc:quit


echo "Input: MPEG2-TS, HDV"
echo "Output: MPEG2 DVD"
ffmpeg -i ${HDV} -target dvd -threads 8 ${DVD}

echo "Input: MPEG2 DVD"
echo "Output: iTunes/iPod compatible MP4"
ffmpeg -y -i ${DVD} -an -v 1 -threads 8 -vcodec h264 -b 250k -bt 175k -refs 1 -loop 1 -deblockalpha 0 -deblockbeta 0 -parti4x4 1 -partp8x8 1 -me full -subq 1 -me_range 21 -chroma 1 -slice 2 -bf 0 -level 30 -g 300 -keyint_min 30 -sc_threshold 40 -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.7 -qmax 51 -qdiff 4 -i_qfactor 0.71428572 -maxrate 450k -bufsize 2M -cmp 1 -s 720x480 -f mp4 -pass 1 /dev/null

ffmpeg -y -i ${DVD} -v 1 -threads 8 -vcodec h264 -b 250k -bt 175k -refs 1 -loop 1 -deblockalpha 0 -deblockbeta 0 -parti4x4 1 -partp8x8 1 -me full -subq 6 -me_range 21 -chroma 1 -slice 2 -bf 0 -level 30 -g 300 -keyint_min 30 -sc_threshold 40 -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.7 -qmax 51 -qdiff 4 -i_qfactor 0.71428572 -maxrate 450k -bufsize 2M -cmp 1 -s 720x480 -acodec aac -ab 160k -ar 48000 -ac 2 -f mp4 -pass 2 -threads 8 ${MP4}


Stay tuned for discussions of the remaining scripts to make your life easier,
CM

Wednesday, February 20, 2008

x264 troubles..ends well

Anyone who reads my blog knows that although I am a loyal Penguin, I'm all about getting the work done expeditiously and distributing my videos to the widest array of formats possible. One of those formats is Apple's Quicktime. And for me, a rendered Quicktime usually ends up as an MPEG4 video in iTunes. With Apple announcing that the new Apple TV 2.0 displays web content as well as iTunes podcasts, higher definition content on iTunes is poised for much growth.

Therefore, it is in that light that I have tasked myself to encode and share some of my band videos to iTunes in glorious (or in the case of my band, un-glorious) DVD resolution. And while I'm at it, I should use tasty H.264 compression for maximum quality at a minimum file size. But of course, this seemingly simple task was much easier said than done.

For me, the rub is that encoding to x264 in Cinelerra is broken. I was getting this error when encoding to H.264:
x264 [error]: no ratecontrol method specified

I had seen this error a few weeks back and emailed the Cinelerra CVS board, but no one had a clue. But tonight, I was going to figure out what the hell was going on. So my first stop was to try encoding to h264 with my old mainstay, ffmpeg. Alas, my friend through thick and thin segfaulted:
[root@ogre 20080206]# ffmpeg -i StormPigs20080206.mpg -an -pass 1 -vcodec h264 -b 1500 -flags +loop -cmp +chroma -partitions +parti4x4+partp8x8+partb8x8 -me epzs -subq 1 -trellis 0 -refs 1 -bf 3 -b_strategy 1 -coder 1 -me_range 16 -g 250 -keyint_min 25 -sc_threshold 40 -i_qfactor 0.71 -bt 1500 -rc_eq 'blurCplx^(1-qComp)' -qcomp 0.6 -qmin 10 -qmax 51 -qdiff 4 output.mp4
FFmpeg version SVN-r8876,
Copyright (c) 2000-2007 Fabrice Bellard, et al.
configuration: --prefix=/usr --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --extra-cflags=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic --enable-libmp3lame --enable-libogg --enable-libtheora --enable-libvorbis --enable-libfaad --enable-libfaac --enable-libgsm --enable-xvid --enable-x264 --enable-liba52 --enable-liba52bin --enable-libdts --enable-pp --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-opts --disable-strip
libavutil version: 49.4.0
libavcodec version: 51.40.4
libavformat version: 51.12.1
built on May 3 2007 12:41:19, gcc: 4.1.2 20070424 (Red Hat 4.1.2-11)
Input #0, mpeg, from 'StormPigs20080206.mpg':
Duration: 01:50:37.0, start: 0.500000, bitrate: 4677 kb/s
Stream #0.0[0x1e0]: Video: mpeg2video, yuv420p, 720x480, 9000 kb/s, 29.97 fps(r)
Stream #0.1[0x80]: Audio: ac3, 48000 Hz, stereo, 448 kb/s
Output #0, mp4, to 'output.mp4':
Stream #0.0: Video: h264, yuv420p, 720x480, q=10-51, pass 1, 1 kb/s, 29.97 fps(c)
Stream mapping:
Stream #0.0 -> #0.0
Segmentation fault


FFmpeg had crapped out, so I gave avidemux2 a shot. When I tried to encode using either command line x264 or x264 encoding through avidemux2, I would get this error:
x264 [error]: width or height not divisible by 2 (480x1)

Update 2009/02/12
Here's a more recent entry regarding proper divisors for x264 compression:
http://crazedmuleproductions.blogspot.com/2009/01/high-quality-h264-output.html
*** end update ***

Well..the video is 720x480. Certainly those two numbers are divisible by two, so what gives with the logic of that error?

After Googling and trying various tweaks for about an hour, it occurred to me that there seemed to be no rhyme or reason to the error I was seeing. With that thought in mind, I decided to remove the x264 package entirely. I had installed the package from freshrpms:

[root@ogre 20080206]# yum remove x264*
Loading "installonlyn" plugin

Setting up
Remove Process

Resolving Dependencies
-->
Running transaction check

---> Package x264.x86_64 0:0.0.0-0.3.20070529.fc7 set to be erased

---> Package x264-devel.x86_64 0:0.0.0-0.3.20070529.fc7 set to be erased


Dependencies Resolved
=============================================================================
Package Arch Version Repository Size
============================================================================= Removing:
x264 x86_64 0.0.0-0.3.20070529.fc7 installed 1.0 M

x264-devel x86_64 0.0.0-0.3.20070529.fc7 installed 712 k


Hmmm. Looking at the version number, it seemed like the x264 from FreshRPMs was a VERY early version number. Let me see if another repository has a different version. Luckily, Livna had some love waiting for me:
[root@ogre 20080206]# yum install x264* --disablerepo=freshrpms
Loading "installonlyn" plugin

Setting up Install Process

Parsing package install arguments

Resolving Dependencies
-->
Running transaction check

---> Package x264.x86_64 0:0-0.8.20061028.lvn7 set to be updated
---> Package x264-devel.x86_64 0:0-0.8.20061028.lvn7 set to be updated

Dependencies Resolved =============================================================================
Package Arch Version Repository Size
============================================================================= Installing:
x264 x86_64 0-0.8.20061028.lvn7 livna 227 k

x264-devel x86_64 0-0.8.20061028.lvn7 livna 15 k


Now that version looks a little more recent, yes? With the new Livna repository x264 installed, I tried my render using the shortest path possible: avidemux2. Lo and behold, x264 no longer complained about my height and width not being divisible by 2! Better yet, I was able to render a complete file using avidemux2's two pass defaults without any errors! Some folks might appreciate seeing the verbose output:
**saving:**
Output format:7
AVI family
Enc X264, using /mnt/videos/20070912/StormPigs20070912.mp4.stat as logfile

X264 Encoder ready , w: 720 h:480 mode:3X264 pass 1
x264 codec using /mnt/videos/20070912/StormPigs20070912.mp4.stat as statfile
Opening X264 for 720 x 480
vui.i_sar_width = 1
vui.i_sar_height = 1
rc.f_qcompress = 0.60
analyse.i_direct_mv_pred = 1
rc.i_qp_min = 10
rc.i_qp_max = 51
rc.i_qp_step = 4
i_frame_reference = 1
i_scenecut_threshold = 40
i_keyint_min = 25
i_keyint_max = 250
i_bframe = 2
i_bframe_bias = 0
b_bframe_pyramid = 0
analyse. b_bidir_me = 0
b_bframe_adaptive = 1
analyse.b_weighted_bipred = 0
b_cabac = 1
analyse.i_trellis = 0
analyse.i_subpel_refine = 2
analyse.b_chroma_me = 1
b_deblocking_filter = 1
i_deblocking_filter_alphac0 = 0
i_deblocking_filter_beta = 0
analyse.i_me_method = 0
analyse.i_me_range = 16
analyse.b_transform_8x8 = 0
analyse.b_mixed_references = 0
analyse.i_noise_reduction = 0
x264 [info]: using SAR=1/1
x264 [info]: using cpu capabilities MMX MMXEXT SSE SSE2
X264 init ok (atom mode : 1)
X264 using 4 threads
Nb nal :3
?? type :6 in nal 0
X264 :Unknown image type:0
X264 :Unknown image type:0

Starting pass 2 (720x480)
[x264] Size 700, average bitrate 1007301 kb/s
x264 [info]: slice I:703 Avg QP: 0.00 size:153296 PSNR Mean Y:70.14 U:71.46 V:71.57 Avg:70.54 Global:67.35
x264 [info]: slice P:124246 Avg QP: 2.00 size: 98655 PSNR Mean Y:59.56 U:60.40 V:60.59 Avg:59.82 Global:57.88
x264 [info]: slice B:49758 Avg QP: 4.00 size: 59273 PSNR Mean Y:66.82 U:67.47 V:67.73 Avg:67.04 Global:57.02
x264 [info]: mb I I16..4: 19.0% 0.0% 81.0%
x264 [info]: mb P I16..4: 9.0% 0.0% 0.0% P16..4: 85.4% 0.0% 0.0% 0.0% 0.0% skip: 5.6%
x264 [info]: mb B I16..4: 4.3% 0.0% 0.0% B16..8: 39.5% 0.0% 0.0% direct:30.0% skip:26.3%
x264 [info]: SSIM Mean Y:0.9992809
x264 [info]: PSNR Mean Y:61.673 U:62.456 V:62.668 Avg:61.920 Global:57.635 kb/s:21017.02

X264 dual size: 700 MB
X264 pass 2, using bitrate of 1007
x264 codec using /mnt/videos/20070912/StormPigs20070912.mp4.stat as statfile
Opening X264 for 720 x 480
vui.i_sar_width = 1
vui.i_sar_height = 1
rc.f_qcompress = 0.60
analyse.i_direct_mv_pred = 1
rc.i_qp_min = 10
rc.i_qp_max = 51
rc.i_qp_step = 4
i_frame_reference = 1
i_scenecut_threshold = 40
i_keyint_min = 25
i_keyint_max = 250
i_bframe = 2
i_bframe_bias = 0
b_bframe_pyramid = 0
analyse. b_bidir_me = 0
b_bframe_adaptive = 1
analyse.b_weighted_bipred = 1
b_cabac = 1
analyse.i_trellis = 2
analyse.i_subpel_refine = 5
analyse.b_chroma_me = 1
b_deblocking_filter = 1
i_deblocking_filter_alphac0 = 0
i_deblocking_filter_beta = 0
analyse.i_me_method = 1
analyse.i_me_range = 16
analyse.b_transform_8x8 = 1
analyse.b_mixed_references = 0
analyse.i_noise_reduction = 0
_8x8P is on
_8x8B is on
_8x8I is on
_4x4I is on
x264 [info]: using SAR=1/1
x264 [info]: using cpu capabilities MMX MMXEXT SSE SSE2
X264 init ok (atom mode : 1)
X264 using 4 threads
Nb nal :3
?? type :6 in nal 0
x264 has 39 extra bytes
We have extradata for video in copy mode (39)
X264 :Unknown image type:0
X264 :Unknown image type:0
[Bridge] Going to time 0

Syncing on 8192
Sync found at offset 0
A52 sync found at 0 + 0
[Bridge] Starting with time 0, shift 0
[Bridge] Ending with time 0, sample 0
[Bridge] Going to time 0

Syncing on 8192
Sync found at offset 0
A52 sync found at 0 + 0
[Bridge] Going to time 0

Syncing on 8192
Sync found at offset 0
A52 sync found at 0 + 0
[FAAC] : Sample input:2048, max byte output1536
[Faac] Initialized :
[Faac]Version : 1.25
[Faac]Bitrate : 192000
[Faac]Mpeg2 (1)/4(0) : 0
[Faac]Use lfe ) : 0
[Faac]Sample output : 1024
[Faac]Bitrate : 384000
[LavFormat] Bitrate 384
Output #0, mp4, to '/mnt/videos/20070912/StormPigs20070912.mp4':
Stream #0.0, 29.97 fps(c): Video: 0x0000, 720x480, q=2-31, 2000 kb/s
Stream #0.1: Audio: 0x0000, 48000 Hz, stereo, 384 kb/s
lavformat mpeg muxer initialized
PacketQueue MP4 audioQ created
[AudioQueueThread] Starting
DMX_audio Going out of bound (position : 326445000 asked 5000 end326446848)
DMX_audio Going out of bound (position : 326446848 asked 5000 end326446848)
**PKTZ:READ ERROR
**END OF AUDIO STREAM
EditorPacket:Read failed; retrying (were at seg 0sample 279810048
/ 279814208)
EditorPacket : End of *last* stream
read failed, end of stream ?
EditorPacket:Read failed; retrying (were at seg 0sample 279810048
/ 279814208)
EditorPacket : End of *last* stream
read failed, end of stream ?
[Bridge] End of stream
EditorPacket:Read failed; retrying (were at seg 0sample 279810048
/ 279814208)
EditorPacket : End of *last* stream
read failed, end of stream ?
[Bridge] End of stream
EditorPacket:Read failed; retrying (were at seg 0sample 279810048
/ 279814208)
EditorPacket : End of *last* stream
read failed, end of stream ?
[Bridge] End of stream
[bridge] No data in 0 max 24448 out 0
[AudioQueueThread] Exiting
[AudioThread] Target 4294901760, got 279810048, 0.065149 %
LavMuxer:Audio DTS is too low 5829354666 / 5829362696!
x264 [error]: 2nd pass has more frames than 1st pass (174709)
x264 [error]: continuing anyway, at constant QP=22
x264 [error]: disabling adaptive B-frames
LavMuxer:Audio DTS is too low 5829354666 / 5829396062!
x264 [info]: slice I:703 Avg QP:18.35 size: 28210 PSNR Mean Y:52.78 U:53.43 V:54.33 Avg:53.09 Global:47.62
x264 [info]: slice P:124248 Avg QP:21.42 size: 5232 PSNR Mean Y:47.14 U:47.26 V:48.82 Avg:47.39 Global:44.70
x264 [info]: slice B:49758 Avg QP:21.06 size: 1286 PSNR Mean Y:58.14 U:58.09 V:59.69 Avg:58.30 Global:45.20
x264 [info]: mb I I16..4: 17.5% 42.4% 40.1%
x264 [info]: mb P I16..4: 2.4% 9.0% 0.2% P16..4: 39.2% 12.0% 2.3% 0.0% 0.0% skip:34.8%
x264 [info]: mb B I16..4: 0.1% 1.2% 0.0% B16..8: 7.7% 0.4% 0.8% direct:14.5% skip:75.3%
x264 [info]: 8x8 transform intra:76.4% inter:65.0%
x264 [info]: SSIM Mean Y:0.9828109
x264 [info]: PSNR Mean Y:50.297 U:50.371 V:51.938 Avg:50.519 Global:44.843 kb/s:1007.06
[Bridge] Destroying bridge
[FAAC] Deleting faac
yv12close called
ba010000 -> ba010000


And best yet, the rendered x264 file loads into iTunes! Hooray!

Of course, I haven't tried actually bringing it to an iPod, but that will be the next thing to do. I'll let you know.
cheers,
da mule

Reference
Here are Apple's specifications for making a podcast:
http://www.apple.com/itunes/store/podcaststechspecs.html

Tuesday, January 15, 2008

dvd file for iTunes

Last night, I was putting together a presentation on my MacBook and wanted to incorporate a DVD resolution video from Cinelerra. Since the Mac world is so tightly controlled, getting the format correct for iTunes was a royal pain. I tried a number of different renders, but only one worked:

file format video audio result
QTforLinux MPEG4 MPEG4 no (crashed iTunes 7.1)
QTforLinux MPEG4 MP3 no
QTforLinux MPEG4 WAV yes
QTforLinux H.264 MPEG4 cinelerra hung

At this point, I'm not sure if its my Fedora 7, x86-64 libraries or just iTunes being very selective about what it likes and dislikes. Just for kicks, tonight I will render out the same file using Fedora 6, i386 and see if the results are the same. Once I finish my research, I'll update the Beginner's Guide.

the mule

Sunday, May 20, 2007

using labels to split rendered video into multiple files

Now that I have my YouTube account, I can go ahead and load it up with a bunch of music videos from the band of miscreants I occasionally play music with. Now, 2006 was a fairly good year for jamming and we had a few stellar sessions at Smash Studios in NYC. The output of these jams usually results in a big video file distributed to my friends. Using Cinelerra, I edit down these three hour sessions into about an hour long video and then distribute that video to my friends via iTunes.

The distributed videos are lower resolution, usually 320x180 MOV files (MPEG4 audio/MPEG4 video) and get pretty big, around 320MB. If you're interested and you have iTunes, you can see some of these monster downloads at itpc://www.stormpigs.com/vodcast.xml.That's really too much to download for any sane person, so my task today was to break up those large videos into small, individual chunks of only the best material from 2006 that I can then upload to YouTube. And hopefully by the end of this post, I'll have some individual songs worth listening to that I can direct you to. With the caveat that the songs were created live, then and there, no rehearsal.

To get back on track, the task is to break up a Cinelerra project into bite size chunks that can then be uploaded to YouTube. This should be fairly simple.

I start with the project that I used to create the one large video. This project has all the audio and video fades and effects that I originally used to create the hour long iTunes video. The good thing about it is that the project has the breaks between video clips delineated clearly. In between the breaks are the actual songs that I'd like to divide up and render out to individual files:


The insertion point will select these breaks very easily, allowing me to set my labels for the render:


This source project is in HDV format. As I've discussed in previous posts, I edit the high resolution source and then output one final as a DVD resolution file, and then convert that DVD to an iTunes-ready format. This does impose some generational loss in quality, but the source material is not that visually stimulating (a bunch of guys in a dark room), so we're not missing much in the two steps down from HDV to iTunes. So now, I have an HDV source project and an output file rendered to DVD. In my previous post (/2007/05/how-to-upload-video-to-youtube.html, I discuss that YouTube allows me to upload up to 100MB or 10 minutes of video. In that post, I also discovered that YouTube recommends this format file:
- MPEG container
- 320x240 resolution
- MP3 audio
- MPEG I/II video

But can also accept files of this format that I can output directly from Cinelerra:
- MOV container (Quicktime for Linux)
- 720x480 resolution
- MPEG4 audio compression (256,000 constant bitrate, stereo)
- MPEG4 video compression (500,000 constant bitrate)

If I break up my project (the recording session) into videos that are less than 100MB each, I will be able to upload the best parts to YouTube. Now, I'm a pretty lazy person in general, so if I don't have to perform an extra step to convert the files from DVD resolution to the preferred 320x240 resolution, I sure as hell won't bother. The test video that I outputted in the last post (specs above) ended up being about a minute and took up about 6.6MB of space at DVD resolution. Theoretically then, I should be OK as long as my songs are less than 10 minutes long (the YouTube limit). Most are, so we should be good to go.

With the constraints understood, I should now have rougly four steps to perform:
1) append my rendered video to a new track in the original source project
2) create labels at the break points between the songs
3) delete the project's original tracks
4) reduce the project size to 720x480
5) render using labels to indicate the start of a new output file

Let's go through these steps.

1) append my rendered video to a new track in the original source project
First, I make sure to move the Insertion Point to the beginning of the timeline. This is where I want my video to be placed. I then select "o" to load my DVD resolution video. This was the original output I rendered from this HDV resolution project. I make sure to select "Append in New Tracks" as my insertion strategy:


2) create labels at the break points between the songs
Now that I have the source video showing the breaks between songs and the outputting video in another track, I can then move the insertion point to each break between songs and set a label by pressing the "l" key:


3) delete the project's original tracks
In order to avoid confusion, I go ahead and delete the original project tracks by scrolling over the tracks in the timeline and pressing the "d" key or right-clicking on a particular track and select "Delete Track." Deleting the older HDV tracks makes sure that I don't accidentally end up re-rendering the HDV video and wasting hours of CPU cycles.

4) reduce the project size to 720x480
To restate, since my original project was in high definition but my newly appended track is at DVD resolution (720x480), I will need to reduce the size of the output video. So I select Shift-F for the formatting menu and change the project format to 720x480:


5) render using labels to indicate the start of a new output file
To render a project into separate files with different names, all I need to do is go into the rendering menu (Shift-R) and check the little box that says "Create new file at each label:"


What this useful little option does is given the output file name that you choose, Cinelerra will create a new file at each label with the format <filename>.<extension>##

where the hash marks indicate a sequence of numbers incremented from 01 to NN, the number of your last label. In other words, if you have 40 labels in your project and the file you're creating is called test.mov, Cinelerra will output the following files:
test.mov01
test.mov02
test.mov03
..
all the way to..
..
test.mov40

Pretty neat, huh?

Of course, you'd probably want to rename those files to something more explanatory. But you get the idea.

To make sure I output a small enough file to upload to YouTube, I augment the video compression bitrate to 500,000 and the audio compression to 256,000 as shown below:




And because I didn't want the first few minutes of introduction to be output, I selected "Selection" for the rendering scope and clicked OK:


The render process is off and running!

To give you an idea how long this particular video took to render, here are some specs:
Video Length: 1hr 4min
Number of Lables: 7
Resolution: DVD (720x480)
Time to Render: 2hr 10min
Computer: Dell 400SC, 3.2Ghz, 800Mhz FSB, 2GB PC3200RAM, Fedora Core 4 SMP kernel

Post Mortem


Here's a link to a few more I've uploaded since my original post yesterday:
http://www.youtube.com/results?search_query=snufflerstormpig

I hope you enjoyed this discussion of multiple file creation using labels. It is one of the many features of Cinelerra and can be very useful in your editing life.

Be good.
The Crazed Video Mule

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

Saturday, April 15, 2006

created iTunes-ready movie from MPG!

Very happy to say that I was able to create an iTunes/iPod-ready movie from an ffmpeg produced mpeg1video! Hoohah! On my second FC4 box that has all the codec libraries, I was able to use the following ffmpeg string to get the iTunes file to work:
ffmpeg -i sourceMpeg -b videobitrate -ab audiobitrate -f mov -vcodec mpeg4 -acodec aac output.mov

So, now my workflow is looking like this:
1) bring in HDV footage
2) run mpeg3toc (or rename files to .MPG)
3) edit video (make sure no hanging or truncated video tracks are there!)
4) render audio file as WAV
5) render video file as MPG and add a -i for the audio
6) outside of Cinelerra, convert to iTunes with the above command
7) convert to DVD with script

Not bad. I'm pooped. Goodnight.

Sunday, March 12, 2006

a foul up

Last night, I encoded my first full length video podcast as a Quicktime from Cinelerra. I brought it into iTunes and used the 'Convert Selection for iPod' feature and it spent all night (from 11pm to 11am) converting. The .MOV file specs were pretty heavy:
- 50 minutes long
- 720x404 resolution
- 524MB

I used a PIII, 1.5Ghz laptop w/512MB of memory to do the conversion, hence the slowness. Once the file was converted, both audio and video tracks played back! Hooray! This was a lot better than my previous result wherein the audio was gone. So, I found the new .M4V file on the filesystem and looked at the metadata in the properties. I saw that there was no metadata, so not thinking that it could have a deleterious effect on the file, I added the missing metadata to the file as it existed on XP. Bad, nary I say REAL bad idea!

After adding the metadata to the file, the .M4V would no longer play in iTunes (6.0.4) or Quicktime. To put it politely..RATS!! I tried removing the metadata, but no go..the file still would not play. So, the twelve hours I spent converting the video was all for naught, cause now I have to do it all again. Wunnerful.

Let me be clear though..
1) you CAN edit the metadata for an iTunes video podcast within iTunes
2) you CANNOT edit the metadata for an iTunes video podcast in the filesystem. This will break the audio for the podcast.

This being the case, I decided to move my website over to my audio workstation in order to allow me to use my main video editing workstation to do the iTunes conversion. Screw the portable..conversion took way too long there. Copying the website from the video editing box to the audio workstation would allow me to use either of my primary machines to serve web content depending on which one I was using at the time. Both are dual boot setups, XP or Win2K and Fedora Core 4, so at least now I have flexibility. Of course, I wish it was under different circumstances that I make that improvement to my workstation setup. Argh.

So now the file is converting on my P4, 3.2Ghz, 1GB box. I'm hoping to get at least a 3x improvement in conversion time. So, I'm looking at 5pm today for the file to be done. 1-5pm..4hrs. Yeesh. I need a faster box..ain't it always the case!

UPDATE: Good news! It only took two hours to convert the file..sweet! I think the remarkable improvement may be bolstered by the MPEG compression available in my All-in-Wonder 9800 Pro video card. I should switch video cards and try this to verify..

Other things of note I'd like to get done:
- setup RSS feed for newly created video
- update Beginner's Guide for bitrate calculation/QT M4V metadata warning
- change rendering partition to ext2 (non-journaling file system)
- eventually get RAID0 back up and running for rendering partition

At least my cam should be coming back from the shop this week!

Sunday, February 26, 2006

Exporting Video from Cinelerra for a Video iPod

So. I really, REALLY wanted MPEG-4 output from Cinelerra to go directly into iTunes and my brother's iPod. I had output a test file:
http://content.serveftp.net/video/renderTest/test.mpeg4.mov (7.8MB)
that loaded and played in iTunes. However, when I went to upload it, iTunes gave me the message:

"Some of the songs in the iTunes music library, including the song "(Video name)",
were not copied to your iPod because they cannot be played on this iPod."



Luckily, Apple provides a feature called "Convert Selection for iPod" when you right-click.
But GEEZ! I already rendered this thing. I've got to do it again? Ugh. OK. And OH NO! The conversion utility takes a RIDICULOUS amount of time! Even on a very fast machine like mine, a 3.2Ghz P4 with 1GB of PC3200 memory, the conversion speed is roughly 1.5 minutes per minute of video. Argh!! That is way TOO slow. But I went ahead and did the conversion with my short test video. On the bright side, once the video was converted, I could then update my iPod and the video was on my iPod. Hooray!!

I continued playing around and loading many different videos into iTunes. In my travels, I stumbled upon one that did not require a conversion. I was shocked! I then reasoned that I'd save a helluva lot of time if I just produced the videos in the format that iTunes expects in the first place. But how to do that? So, my next course of action was to research why that one file worked in iTunes without a conversion and why mine needed the conversion.

To do this, I analyzed the output of MPlayer to determine the differences between files. I learned quite a bit over the past couple of days about audio and video formats by reviewing the output of MPlayer. It helps to have the text of both files displayed in two windows next to each other in order to more easily compare the files line by line. I've done this for you in the image below (click this link with SHIFT-click to open a second browser window):
http://content.serveftp.net/video/renderTest/cinItunesConversion.jpg

Reviewing the diffences, I noticed the following:
1) iTunes compatible file had the audio track as the first track in the MOV container, my file had the video as the first track
2) iTunes compatible file was 44.1Khz audio, my file was 48000Khz
3) iTunes compatible file included an extra audio header, my file didn't have the extra header
4) iTunes compatible file audio compression method was MPEG-4, my file was twos complement
5) iTunes compatible file FPS rate was 15, my file was 59.97

After way too many hours of trial and error (and scowls from my girlfriend and dog), I am proud to say that I have found the settings in Cinelerra that will make an MPEG-4 video totally compatible with iTunes so that iTunes does not need to re-render (the "Convert Selection for iPod" feature) the video!

Here are the specs:

For the project:
Set Format
Sample Rate to 44100khz
Number of Channels to two
FPS can be the FPS of your source video
(try lower to 25 or less if problems)
Width 320
Height 240 (320x180 fine as well)
For the render:
Audio
MPEG-4 Audio
Bitrate 128000
Quantization of 100
Video
MPEG-4 Video
The rest of the parameters are Cinelerra's
defaults, but I will reiterate here:
Bitrate 7000000
Tolerance 500000
Fixed Quantization selected
Quantization 10
Keyframe Interval 45

I don't care how you do it, but you have to get your videos in that format
because iTunes is COMPLETELY STRICT when it comes to these settings! If you expect your video to upload into iTunes without needing a re-render, you
CANNOT deviate from ANY of these settings!!

Caveat: with the possible exception of the MPEG-4 Video defaults. But I
would only deviate from the settings after you've got the file uploaded into
iTunes without any issues first.

Please let me know how this works for everybody,
scott

References:
http://www.apple.com/ipod/specs.html
http://www.ipodwizard.net/showthread.php?t=4413
http://members.shaw.ca/Kyle-Rogers/
Beginner's Guide to Exporting Video from Cinelerra

Update 10/15/2008
Making a Podcast, by Apple