YouTube >
2020-07-22 -- This is a whole pile of notes and instructions. It's technically not obsolete but there are much better ways to do almost everything described herein.
- 1 To do
- 2 2009-01-28 - full-blown multimedia 01 - pictures, subtitles and a webcam overlay.
- 3 (TODO NEXT) - use a full-quality video track.
- 4 COMING LATER - DATE - opening music 01
- 5 2009-01-26 - high quality test 03 - Testing widescreen and actual high quality, with an alternate soundtrack. Failed to even get stereo!
- 6 COMING LATER - DATE - music-to-video 03 - More aggressive mixed-media test. Failed to even get stereo!
- 7 COMING LATER - DATE - music-to-video 02 - Playing with SoX audio effects. Failed to get noticed as high quality.
- 8 COMING LATER - DATE - music-to-video 01 - Converting a Commodore SID into a video. Failed to get noticed as high quality.
- 9 2009-01-24 - high quality test 02 - Testing widescreen and actual high quality. Success.
- 10 2009-01-23 - mixed-media test 01 - Testing multiple tools. Success.
- 11 Editing videos
To do ∞
-
Code from scratch, and use ffmpeg-rb
- fade-to-black and cross-fade effects.
- Videos which are engineered to be detected by YouTube as "high quality" have their "low quality" version further-reduced in quality! How do I keep the "low quality" version as good as traditional normal-quality videos which have no high quality version?
- When adding an audio track, I may need force a few extra seconds of video for the audio to fade out properly.
- How do I determine the length of an audio track?
- What tools are good for working with audio? Audacity? Or maybe make a video of it and then work with it in Avidemux.
- video quality of resized screencasts.
- volume adjustment (normalization, dB boost)
- in-video subtitles
-
add a proper audio track to a PNG-converted-video.
-
http://housegeekatheart.blogspot.com/2008/07/how-to-make-high-quality-youtube-video.html
2009-01-28 - full-blown multimedia 01 - pictures, subtitles and a webcam overlay. ∞
(Subtitles was created when I was experimenting with this part of things.)
Build picture-video ∞
~/pic1.png ~/pic2.png ~/pic3.png
-
make your image:
kolourpaint ~/kolourpaint1.png
control-e
and change the canvas size to 640x360.-
length = (minutes * 60 + seconds) * frames per second
- So 3:30 * 25fps = a length of 5250
-
convert it to a video, and append an empty sound track:
- (FFmpeg)
FPS=30 SETTINGS="-y -ac 1 -ar 44100 -r $FPS -sameq" LENGTH=300 ffmpeg $SETTINGS -loop_input -vframes $LENGTH -i ~/pic1.png -f s16le -i <(dd if=/dev/zero bs=19200 count=1) ~/pic1.avi ffmpeg $SETTINGS -loop_input -vframes $LENGTH -i ~/pic2.png -f s16le -i <(dd if=/dev/zero bs=19200 count=1) ~/pic2.avi ffmpeg $SETTINGS -loop_input -vframes $LENGTH -i ~/pic3.png -f s16le -i <(dd if=/dev/zero bs=19200 count=1) ~/pic3.avi
Then use Avidemux to bind them all together. No special settings needed. Save as ~/pics.avi
TODO: Advanced slideshow stuff?
Make the webcam video ∞
ffmpeg -i ~/cheese1.ogg cheese-pics%d.png
Strip the audio from this video:
ffmpeg -i cheese1.ogg -vn -acodec pcm_s16le -ar 44100 -ac 2 cheese1.wav
Overlaying the webcam video overtop of the picture video ∞
NOTE: The .dv
which kino creates as a working file is massive. Make sure you have the disk space for it.
- kino
- FX (on the right) > Video Filter > Superimpose > Image:
/home/user/cheese-images%d.png
- Zoom out a bunch.
- Added it at y of -60 .. because of kino padding the video for some reason.
-
Put it in the bottom-right?
export as ~/pics
For some stupid reason kino resizes and pads the video from 640x360 up to 720x480, so I have to process it.
But it ALSO chops off 10 seconds of video! WHAT THE FUCK
.....
SETTINGS="-y -sameq" SIZE=540x360 TOP=0 BOTTOM=0 LEFT=50 RIGHT=50 ffmpeg -i ~/pics.mpeg $SETTINGS -s $SIZE -padtop $TOP -padbottom $BOTTOM -padleft $LEFT -padright $RIGHT ~/pics2.avi
not very good.. I need to play with cropping some more, sigh.
ffmpeg -i ~/pics.mpeg $SETTINGS -cropbottom 40 -croptop 40 ~/pics2.mpeg
Add in-video subtitles ∞
-
https://web.archive.org/web/20170515162148/http://home.gna.org:80/subtitleeditor/ [ 1 ] I think this has become https://kitone.github.io/subtitleeditor/ (in the repo!) [ 2 ] I don't know which repository this was referring to, perhaps Unity Linux.
- cannot use a subtitle right at the beginning
- timing on subtitles lags a bit
- can't put subtitles right up against one another.. there's a small delay forced between
- SubRip =
.srt
(Avidemux)
avidemux2_gtk ~/kolourpaint2.avi
Top Menu :: Audio :: Main track
- Audio source: External WAV
-
External file: (browse for
~/cheese1.wav
)
Video: MPEG-4 ASP (Xvid4)
-
Filters :: Subtitles
- Subtitles file:
/home/user/subtitles.srt
- Font (TTF):
/usr/share/fonts/TTF/arial.ttf
- Subtitles file:
Audio: AAC (FAAC)
-
Filters
- Resampling: 44100
Format: MP4
-
save as
~/kolourpaint3.mp4
Build for high quality ∞
TODO - Do more research and testing on this idea.
TODO - Do it right.
(TODO NEXT) - use a full-quality video track. ∞
Confirm that it uploads and is seen as high quality. Then swap out its entire soundtrack.
COMING LATER - DATE - opening music 01 ∞
2009-01-26 - high quality test 03 - Testing widescreen and actual high quality, with an alternate soundtrack. Failed to even get stereo! ∞
Gather original content ∞
Taking content from YouTube/music-to-video 03[doesn't exist].
Prepare the high-quality video clip ∞
-
Determine the dimensions of your video:
(FFmpeg)
ffmpeg -i ~/example.avi
NOTE: If you have issues with FFmpeg, try MPlayer:
mplayer ~/example.avi
- Convert the video
-
Calculate the resize and the padding needed.
- Example: 688x304 becomes 640x282 with a top/bottom pad of 38/40
(FFmpeg)
SETTINGS="-y -sameq" SIZE=640x282 TOP=38 BOTTOM=40 LEFT=0 RIGHT=0 ffmpeg -i ~/example.avi $SETTINGS -s $SIZE -padtop $TOP -padbottom $BOTTOM -padleft $LEFT -padright $RIGHT ~/01-high-quality-test1.avi
convert the video clip to mp4 ∞
(Avidemux)
avidemux2_gtk ~/01-high-quality-test1.avi
Video: MPEG-4 ASP (Xvid4)
-
Configure:
- Main :: Encoding type: Two Pass - Average Bitrate (Single Pass - Bitrate to do it faster, with a bigger file)
- Average bitrate: 1500
-- YouTube requires over 600 kb/s (unconfirmed)
Audio: AAC (FAAC)
-
Filters
- Resampling: 44100
- Dynamic Range Compression: (yes)
Format: MP4
-
save it as
~/01-high-quality-test2.mp4
Make the picture-video ∞
-
Convert a Commodore SID tune:
- Note: A time of 3:30 is probably wrong, but I'm okay with that.
(SIDPLAY2)
sidplay2 -o2 -w -s ~/Arkanoid1.sid mv ~/Arkanoid\[2\].wav ~/Arkanoid2.wav
Add an ending fade ∞
(SoX)
sox Arkanoid2.wav Arkanoid3.wav fade 0 3:30 10
make your image ∞
kolourpaint ~/kolourpaint1.png
-
control-e
and change the canvas size to 640x360.
convert your image into a video ∞
-
length = (minutes * 60 + seconds) * frames per second
- So 3:30 * 25fps = a length of 5250
-
convert it to a video, and append an empty sound track:
(FFmpeg)
FPS=25 SETTINGS="-y -ac 2 -ar 44100 -r $FPS -sameq" LENGTH=5250 ffmpeg $SETTINGS -loop_input -vframes $LENGTH -i ~/kolourpaint1.png -f s16le -i <(dd if=/dev/zero bs=19200 count=1) ~/kolourpaint2.avi
Add the audio track into the picture-video ∞
(Avidemux)
avidemux2_gtk ~/kolourpaint2.avi
Top Menu :: Audio :: Main track
- Audio source: External WAV
-
External file: (browse for
~/Arkanoid3.wav
)
Video: MPEG-4 ASP (Xvid4)
-
Configure:
- Main :: Encoding type: Two Pass - Average Bitrate (Single Pass - Bitrate to do it faster, with a bigger file)
- Average bitrate: 1500
-- YouTube requires over 600 kb/s (unconfirmed)
Audio: AAC (FAAC)
-
Filters
- Resampling: 44100
- Dynamic Range Compression: (yes)
Format: MP4
-
save as
~/kolourpaint3.mp4
Combine the videos ∞
(Avidemux)
avidemux2_gtk ~/01-high-quality-test2.mp4
-
append
~/kolourpaint3.mp4
Video: MPEG-4 ASP (Xvid4)
-
Configure:
- Main :: Encoding type: Two Pass - Average Bitrate (Single Pass - Bitrate to do it faster, with a bigger file)
- Average bitrate: 1500
-- YouTube requires over 600 kb/s (unconfirmed)
Audio: AAC (FAAC)
-
Filters
- Resampling: 44100
Format: MP4
save it as ~/kolourpaint4.mp4
COMING LATER - DATE - music-to-video 03 - More aggressive mixed-media test. Failed to even get stereo! ∞
COMING LATER - DATE - music-to-video 02 - Playing with SoX audio effects. Failed to get noticed as high quality. ∞
(SoX)
COMING LATER - DATE - music-to-video 01 - Converting a Commodore SID into a video. Failed to get noticed as high quality. ∞
2009-01-24 - high quality test 02 - Testing widescreen and actual high quality. Success. ∞
-
Determine the dimensions of your video:
(FFmpeg)
ffmpeg -i ~/example.avi
NOTE: If you have issues with ffmpeg, try MPlayer:
mplayer ~/example.avi
- Convert the video
-
Calculate the resize and the padding needed.
- Example: 688x304 becomes 640x282 with a top/bottom pad of 38/40
SETTINGS="-y -sameq" SIZE=640x282 TOP=38 BOTTOM=40 LEFT=0 RIGHT=0 ffmpeg -i ~/example.avi $SETTINGS -s $SIZE -padtop $TOP -padbottom $BOTTOM -padleft $LEFT -padright $RIGHT ~/01-high-quality-test1.avi
-
convert the video and audio:
(Avidemux)
avidemux ~/01-high-quality-test1.avi
Video: MPEG-4 ASP (Xvid4)
-
Configure:
- Main :: Encoding type: Two Pass - Average Bitrate (Single Pass - Bitrate to do it faster, with a bigger file)
- Average bitrate: 1500
-- YouTube requires over 600 kb/s (unconfirmed)
Audio: AAC (FAAC)
-
Filters
- Resampling: 44100
Format: MP4
Save it as ~/01-high-quality-test2.mp4
2009-01-23 - mixed-media test 01 - Testing multiple tools. Success. ∞
the test ∞
- sources
-
Cheese -- Capture video from a webcam, and audio from an external mic. Saves as a
.ogg
- avidemux cannot open the resulting file. I get
First packet : not a header 80?
so I convert it to an.avi
. - Very bitchy program. Might hang. Keep trying.
- avidemux cannot open the resulting file. I get
-
recordmydesktop -- Screencasting. Saves as a
.ogv
- This program will slow your computer down. Be patient.
- note that it'll record that screen area, not just that window.
- HandBrake -- Rip video and audio from a DVD. Saves as a
.???
(not noted) -
kolourpaint -- Create an image slide.
- tools
- Avidemux -- Chopping and splicing, resizing and padding videos.
-
FFmpeg -- Video format conversion, and adjusting audio and video parameters.
Next, you need to edit these two to resize them. While your at it, feel free to cut down the DVD to only include a partial scene. Save without the "-unresized" part of the filename.
Use these settings:
- video: FLV1 (lavc)
- audio: MP3 (LAME)
-
format: FLV
So your working with these files:
~/02-recordmydesktop-unresized.avi | => | ~/02-recordmydesktop.flv |
~/03-handbrake-unresized.avi | => | ~/03-handbrake.flv |
Also edit 01
and 04
to change their settings too:
~/01-cheese.avi | => | ~/01-cheese.flv |
~/04-kolourpaint-process.avi | => | ~/04-kolourpaint.flv |
- Resize the videos to the same standard.
- In my case, my original cheese capture was 320x240 already, so I won't edit it further.
- On the left, choose a 'Format' of 'FLV'
-
On the left, choose video from 'copy' to 'FLV1 (lavc)'. Click 'Filters'
- Then for 'Transform', choose 'MPlayer resize' and click the '+'
- DO SOME MATH (see below)
- Resize to the "keep aspect ratio" numbers you got.
-
Click 'Add black borders' and click the
+
- DO SOME MATH (see below)
- Add either a height or a width
avidemux2_gtk ~/02-recordmydesktop.flv
- (etc)
- RESIZE MATH
- resize and prefer the larger value to one of width 320 or height 240. Keep the ratio, so that the resulting resize fits within 320x240.
- THE CHEAT: Launch kolourpaint.
- Resize the canvas (
control-e
) to your video size. - Resize the canvas (
control-e
) and select a width of 320. Click "keep aspect ratio". - Now if the height is under 240, remember (height) and (240-height, round down) and return to avidemux.
- If not, resize the canvas (Control-E) and select a *height* of 240. Click "keep aspect ratio".
- Now if the width is under 320, remember (width) and (320-width, round down) and return to avidemux.
- If not, you did something wrong. :)
- Example: 1008x704 becomes 320x223 rounded to 320x222 with a leftover of 18
- Example: 720x304 becomes 320x135 rounded to 320x134 with a leftover of 106
- BORDER MATH
- Take your leftover (it is an even number) and split it in half.
- If the number is odd, then make one number bigger than the other.
- Apply that number back to either the height or the width.
- Example: 320x222 has a leftover width of 18. Split, it's 9. It should be 8 and 10.
-
Example: 320x134 has a leftover width of 106. Split, it's 53. It should be 52 and 54.
Combine your four source files:
~/01-cheese.flv
~/02-recordmydesktop.flv
~/03-handbrake.flv
-
~/04-kolourpaint.avi
With Avidemux, open up the first webcam capture. Then append each resized video to it.
Use these settings before saving:
- video: FLV1 (lavc)
- audio: MP3 (LAME)
-
format: FLV
avidemux2_gtk ~/01-cheese.flv
- Save it out as ~/00-combined.flv
-
Re-open that file with Avidemux to confirm it's sane. If it's not, don't come to me for help:
avidemux2_gtk ~/00-combined.flv
tutorial notes ∞
- make some appropriate-sized images with titles, to insert between sections.
- script the sections
-
Create a 640x360 window. Since Openbox doesn't show me the dimensions as I resize, I'll use wmctrl. I can use it on an xterm window and it'll define the proper area even though I have openbox set to resize to the nearest character in fixed-font windows:
wmctrl -F -r "user@localhost: /home/user" -e 1,0,0,640,360
-
Select that window as your working area, with recordmydesktop:
gtk-recordMyDesktop
mv ~/out.ogv ~/recordmydesktop-original.ogv SETTINGS="-y -ac 1 -ar 22050 -r 30" ffmpeg -i ~/recordmydesktop-original.ogv $SETTINGS ~/recordmydesktop.avi
Editing videos ∞
newer notes ∞
- Video
- 16:9 video, recommended 1280x720
- 4:3 video, recommended 640x480
-
h264, mpeg4 or FLV1
- Vp8 will be nice once ffmpeg has it cooked in by default.
- If your file is using h264 encoding we prefer files without PAFF/MBAFF encoding.
- Audio
-
Vorbis Audio, AAC, MP3
- Containers
-
mp4, avi, mpf, flv, etc..
earlier notes ∞
- http://hcoder.org/2008/07/23/linux-video-editing-and-youtube-annotations/
- Video Editing Magic with ffmpeg
-
Encoding for YouTube Using Compressor (Mac) by Brian Gary
Video | |
---|---|
Resolution | 1290 x 720 (16x9 HD) and 640 x 480 (4:3 SD)
There is no required minimum resolution - in general the higher resolution the better and HD resolution is preferred. For older content, lower resolution is unavoidable. |
Bit rate | Because bit-rate is highly dependent on codec there is no recommended or minimum value. Videos should be optimized for resolution, aspect ratio and frame rate rather than bit rate. |
Frame rate | The frame rate of the original video should be maintained without re-sampling. In particular pulldown and other frame rate re-sampling techniques are strongly discouraged. |
Codec | H.264, MPEG-2 or MPEG-4 preferred. |
Audio | |
Codec | MP3 or AAC preferred |
Sampling rate | 44.1kHz |
Channels | 2 (stereo) |
Container | MPEGTS (MPEG2 transport stream) |
High quality:
- Flash Video (FLV)
- 352x288
-
Make it as high bitrate as possible while still staying under YouTube's limits (100MB, 10 minutes).
To get the second-highest quality, encode in QuickTime Pro:
- MPEG4 Improved
- 320x240
- keyframe every 2-6 frames
-
3500kbits/sec.
If you don't have [http://www.apple.com/quicktime/pro/ QuickTime Pro], use [http://www.isquint.org/ iSquint] (now open sourced as [http://transcoderredux.svn.sourceforge.net/viewvc/transcoderredux/] and [http://sourceforge.net/projects/transcoderredux/]) and set "TV Quality" at the highest quality.
In QuickTime Pro, check "Preserve aspect ratio using: Letterbox," if you're encoding something 16:9. Otherwise, for 4:3 material you don't have to bother.
Youtube "safe" video attributes:
- format: flv video
- length: < 11 minutes
- bitrate: < 350 kbits/sec
-
aspect: 1.33:1 (320x240)
NOTES:
- Resize down to 320x240 since YouTube will re-encode anyways.
- Then I would encode as MPEG-4 ASP in AVI container using Xvid. I'd use "Constant Quantizer" mode at a value of ~4.0 or even lower.
- MP3 audio has to be 22.05 kHz (otherwise it gets reencoded by YouTube)
-
Then it's quite easy to test if it works - just download the final Flash video from YouTube and compare it to your local file. Not the files themselves, but the streams inside - you can dump the audio and video streams from both files with MPlayer and then compare them with cmp (on *NIX) or fc (Windows). If they're identical, YouTube did not reencode them.
At the moment you can upload an FLV1 Flash clip to youtube and have it pass under the radar unconverted.
This saves a lot of time during upload, because you're uploading a lot smaller files.
Saves suprises, as you know what you're getting before upload, and you get control over your content.
The restriction (besides standard youtube duration restriction) is that your .flv
has to have a total bitrate under 350kbps
Footnotes
^ 1 | I think this has become https://kitone.github.io/subtitleeditor/ |
^ 2 | I don't know which repository this was referring to, perhaps Unity Linux. |
- basic port
- ported the 2009-01-23 efforts.
ported 2009-01-24 - high quality test 02 - Testing widescreen and actual high quality. Success.
ported high quality test 03
ported full-blown multimedia 01