Skip to content

Instantly share code, notes, and snippets.

Last active August 29, 2015 13:56
What would you like to do?
Simple video creation with Xholon
<?xml version="1.0" encoding="UTF-8"?>
<!--Xholon Workbook MIT License, Copyright (C) Ken Webb, Sun Feb 23 2014 08:45:46 GMT-0500 (EST)-->
Title: Simple video creation with Xholon
Description: Simple video creation with Xholon
InternalName: 8984157
My Notes
February 13, 2014
I'm starting to create some simple videos (screencasts) from existing Xholon apps.
I've never done this before.
I'll use this Xholon Workbook to help learn what I need to know,
by taking notes, organizing the stuff I read, and maybe creating some procedures.
For now I'll restrict myself to tools that work with the two Linux distribution I use, Ubuntu and Linux Mint.
I'd like the resulting videos to play on all modern browsers (Chrome, Firefox, OPera, Safari, IE9+), in my own web pages, at Youtube, and at Vimeo.
The wikipedia screencast page has this to say:
"A screencast is a digital recording of computer screen output, also known as a video screen capture, often containing audio narration."
As much as possible, I'll use neutral/consensus terminology from wikipedia pages.
To get started, I've downloaded and used two tools
- SimpleScreenRecorder to capture video content from a web page while a Xholon app is running
- kdenlive to create a finished video from a collection of video clips, audio clips, and static images
YouTube supports the following file formats (14):
Here are supported video format for YouTube (15):
* WebM files (Vp8 video codec and Vorbis Audio codec)
* MPEG4, 3GPP and MOV files - (typically supporting h264 and mpeg4 video codecs and AAC audio codec)
* AVI (Many cameras output this format - typically the video codec is MJPEG and audio is PCM)
* MPEGPS (Typically supporting MPEG2 video codec and MP2 audio)
* FLV (Adobe - FLV1 video codec, MP3 audio)
Because I want to use open-source/free containers and codecs, and because I want to be able to upload to Youtube,
then probably the WebM container is what I should target.
- Does Vimeo support WebM?
- Do my target web browsers all support this?
Perhaps better is to think about a best base format, that can be transformed into any other format I'll need.
- Perhaps Matroska?
It's hard to tell what the Vimeo requirements and formats are, but here's a process to follow:
I may need to use Handbrake:
"HandBrake is a tool for converting video from nearly any format to a selection of modern, widely supported codecs."
- <video> and <audio> tag
- "By default HandBrake saves all files in the MP4 container" (37)
- "HandBrake can also save files in the widely popular MKV container" (37)
- uses selected ffmpeg stuff
- has command-line interface (CLI), and GUI (Windows, Mac)
February 17, 2014
I could use a Petri Net (PN) to define transformation processes.
PN places would be lineups, and PN transitions would be processes that transform lineups into other lineups.
February 19, 2014
I've looked at a few tools for downloading content from YouTube and other sites.
Both of the following can be instaled using UBuntu Software Center, and Linux Mint Software Manager:
- youtube-dl it works well
- minitube not tested yet
February 23, 2014
All of the parameters in the Xholon lineup tags could be converted to ffmpeg or libav (avconv) options.
For example, to convert a 1280x720 mp4 video to 640x360:
ffmpeg -i infile.mp4 -s 640x360 outfile.mp4
avconv -i infile.mp4 -s 640x360 outfile.mp4
HD - high definition
SD - standard definition
720p - 720 pixels high, with progressive scanning
1080i - 1080 pixels high, with interlaced scanning
fps - frames per second
1280x720 - 1280 pixels wide by 720 pixels high
4:3 (or 4/3) - display aspect ration (ex: 640x480, where 480*4/3 = 640)
16:9 (or 16/9) - display aspect ration (ex: 1280x720, where 720*16/9 = 1280)
(16) "Youtube getting started"
"Youtube upload videos"
"Advanced encoding settings; Recommended bitrates, codecs, and resolutions, and more"
"tools to create, alter and inspect Matroska files under Linux, other Unices and Windows"
fork of ffmpeg
<!-- Digital container format
a metafile format whose specification describes how different data elements and metadata coexist in a computer file
<!-- these are non-proprietary, non-patent-encumbered container formats -->
<Matroska/> <!-- .mkv video/x-matroska audio/x-matroska -->
<Mcf/> <!-- Multimedia Container Format .mcf, .av.mcf, .audio.mcf, .video.mcf -->
<Ogg/> <!-- .ogg video/ogg,audio/ogg -->
<!-- WebM
"WebM is an open, royalty-free, media file format designed for the web.
WebM defines the file container structure, video and audio formats.
WebM files consist of video streams compressed with the VP8 video codec
and audio streams compressed with the Vorbis audio codec.
The WebM file structure is based on the Matroska container."
<WebM/> <!-- .webm video/webm,audio/webm -->
<!-- other popular container formats -->
<Mp4/> <!-- MPEG-4 Part 14 .mp4 video/mp4 -->
<Codec superClass="Attribute_String">
<!-- Video codec
"A video codec is software or a device that provides encoding and decoding for digital video,
and which may or may not include the use of video compression and/or decompression." (28)
"A video codec is a device or software that enables compression or decompression of digital video.
The compression is usually lossy." (27)
<H.264/> <!-- x264; MPEG-4 Part 10 or AVC (Advanced Video Coding); Vimeo recommends H.264 -->
<Mpeg-4_Part_2/> <!-- MPEG-4 Part 2 -->
<Theora/> <!-- VP3; libtheora is a reference implementation of the Theora video compression format. (31) -->
<Vp8/> <!-- libvpx (VP8 codec library) (32) -->
<Aac/> <!-- Advanced Audio Coding; Vimeo recommends AAC-LC (30) -->
<InternetExplorer/> <!-- IE9+ -->
<DesktopMediaPlayer> <!-- Linux -->
<NonEndUse> <!-- internal formats while capturing and editing video/audio/images -->
<!-- HTML5 media (video, audio) players -->
<Converter superClass="TransitionPN"> <!-- Petri Net transition -->
<!-- command-line converters -->
<HandBrake/> <!-- saves files to Mp4 or Matroska container -->
<!-- GUI-based converters/editors -->
<Lineup/> <!-- profile, some specific set of parameters -->
<!-- any small or large fragment of a complete media project,
converters convert media clips into other media clips
<MediaClip superClass="PlacePN"> <!-- Petri Net place -->
<Image/> <!-- PNG, JPEG, etc. -->
<MediaSystem/> <!-- top-level node in the CSH -->
<!-- ??? -->
<MediaProject roleName="Lotr">
<InputArc weight="1" connector="ancestor::MediaProject/VideoClip[1]"/>
<OutputArc weight="1" connector="ancestor::MediaProject/VideoClip[2]"/>
<VideoClip lineup="simpleScreenRecorder1"/>
<VideoClip lineup="youTube2"/>
all of these lineups have one container (ex: WebM),
which in turn has one video format (ex: Vp8), and one audio format (ex: Vorbis)
H.264 parameters: possible values (units)
================ =============== =====
definition: SD, HD
bitRate: 2000 - 5000, 5000 - 10000 (kilobits per second (kbps)) data rate
width: 640, 640, 1280 (pixels)
height: 480, 360, 720 (pixels)
scan: p, i
frameRate: 23.976, 24, 25, 29.97, 30 (frames per second (fps))
<YouTube roleName="youTube1"> <!-- WebM files (Vp8 video codec and Vorbis Audio codec) -->
<YouTube roleName="youTube2"> <!-- MPEG4 (typically supporting h264 and mpeg4 video codecs and AAC audio codec) -->
"definition": "HD",
"width": 1280,
"height": 720,
"scan": "p",
"frameRate": 30,
"bitRate": 12000
<Vimeo roleName="vimeo1"> <!-- source (30) -->
<Mp4> <!-- ? -->
"definition": "HD",
"width": 1280,
"height": 720,
"scan": "p",
"frameRate": 30,
"bitRate": 10000
source (36)
MP4 = MPEG 4 files with H264 video codec and AAC audio codec
WebM = WebM files with VP8 video codec and Vorbis audio codec
Ogg = Ogg files with Theora video codec and Vorbis audio codec
<Chrome roleName="chrome1"> <WebM>
</WebM> </Chrome>
<Chrome roleName="chrome2"> <Mp4>
</Mp4> </Chrome>
<Chrome roleName="chrome3"> <Ogg>
</Ogg> </Chrome>
<Firefox roleName="firefox1"> <WebM>
</WebM> </Firefox>
<Firefox roleName="firefox2"> <Mp4>
</Mp4> </Firefox>
<Firefox roleName="firefox3"> <Ogg>
</Ogg> </Firefox>
<Safari roleName="safari1"> <Mp4>
</Mp4> </Safari>
<Opera roleName="opera1"> <WebM>
</WebM> </Opera>
<Opera roleName="opera2"> <Ogg>
</Ogg> </Opera>
<SimpleScreenRecorder roleName="simpleScreenRecorder1"> <Matroska> <!-- ??? -->
<!-- Matroska can include any video format and any audio format
this lineup is the same as for WebM which is based on Matroska
</Matroska> </SimpleScreenRecorder>
<!-- SimpleScreenRecorder offers other lineups -->
<H.264behavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[
var myH264;
var beh = {
postConfigure: function() {
myH264 = this.cnode.parent();
var txt = myH264.text();
if (txt) {
var params = JSON.parse(txt);
act: function() {
var txt = myH264.text();
if (txt) {
var params = JSON.parse(txt);
var tool = "ffmpeg"; // or use "avconv"
var ffmpegTxt = "ffmpeg -i infile.mp4"
// convert the width and height to half the values of the original video
+ " -s " + params.width/2 + "x" + params.height/2
// retain the same bit rate as the original video
+ " -b " + params.bitRate
+ " outfile.mp4";
<SvgClient><Attribute_String roleName="svgUri"><![CDATA[data:image/svg+xml,
<svg width="100" height="50" xmlns="">
<rect id="MediaSystem/MediaProject" fill="#98FB98" height="50" width="50" x="25" y="0"/>
<rect id="MediaSystem/MediaProject/Converter" fill="#6AB06A" height="50" width="10" x="80" y="0"/>
]]></Attribute_String><Attribute_String roleName="setup">${MODELNAME_DEFAULT},${SVGURI_DEFAULT}</Attribute_String></SvgClient>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment