Video Editing and publishing Workflow with openSUSE Linux (2015, OSC15)
Editing vidéo is both easy and very demanding to the harware. openSUSE is now able to do it pretty well
Working with videos
Video sources and formats
Nowaday (2015), one can have videos from a great number of devices. On the low end, smarphones can do them pretty well, on the high end professional cameras can be extremely expensive. Be prepared to have a computer hardware at a price similar to the one of the camera. Professional software do not even install on consumer grade current computers, but I guess you are not this kind of people, else you wouldn't ask me :-).
Every video source have it's own current video file format. There is no "standard" like jpg in photo world. Even more, video are nearly always made of images and sound, and recording (and working) with video and audio needs "synchronization", specially for lip dub (when the people that speaks is seen in close up) and this is often the most demanding problem.
Most "file format" in video are not image or audio formats but "containers" that can hold various things. So the first software you have to install is "mediainfo". This one exists for every operating system and is able to show you precisely what is in your mov, mts, avi... file.
There are too many real video formats for me to speak of all of them. Most common are defined by the Moving Picture Expert Group (mpeg). It's enough to remember than mpeg-2 is the DVD format and mpeg-4 (mp4, AVCHD) the Blu-Ray one. These two formats are both lossy compression formats and as far as I know, there are no uncompressed video formats at all, even the old "DV" format used on video tapes was a bit lossy. There is also a mjpeg format used is some camcorders, that is approximately made of joined jpg photos.
You mainly have to know that as the compression increase, the size of the video file grow at similar quality. Good DV video is 10Gb an hour (one DV tape), good mp4 HD video file is also around 10 Gb an hour, but with a much better quality. But what is compressed have to be uncompressed and it's that that is demanding for the hardware! The file you see on the image is a HD video from a sport camcorder with approx 5 Gb an hour.
You have choice for the inputformat -most camcorders have various setup. The format used have little impact on the quality (as long as it's HD 1024), the main variable is the recording bit rate. I found than for most use 17Mb/s is all what I need.
You also have to choose the main output format. Choose mp4, it's the wider readable format. I use 12Mb/s bit rate for images and 192kb/s for sound -I record musics and the usual 128 is not enough.
mp4 can be used as is on Blu-Ray, nearly any DVD/BD reader reads any mp4, but you lack the usual menus of the professional disks. Alas Linux (and so openSUSE) lacks a Blu-Ray authoring software, so menus are not an option.
Being a small number of huge files, and edition being pretty long, videos have to be managed by scripts. The main video editors programs are ffmpeg and mencoder and they seems to merge, using the same video library, libavcodec.
The content of the video files are compressed / uncompressed by so called "codecs". The files themselves are cut in smaller sizes, because most supports are FAT32 and FAT32 can't manage easily more than 2 Gb large files. This size cut have as result on some camcorders a loss of 1 or two images at the cut position, but there is little we can do to fix this. This size is pretty good, have no other drawback and makes dealing with video files simpler, it's possible but not recommended at all to merge them (think you may once copy then to an usb key).
Each file hold approx 10 minutes of video. If it's possible to stop the recording in smaller chunks, you will escape the image loss.
You will have two ways to edit videos: changing only format, size, quality of a bunch of files, or cutting these files in pieces to be merged afterward. The latter is called "linear editing". In openSUSE most applications are only building parameters for a hidden script. The better one allows you to know what this script will be (simpler to reuse it). To edit small files, some kind of GUI is sometime better. Look after "avidemux" or "handbrake". Handbrake is the must if the resulting file have to be mp4, you can even rip a dvd in mp4 files with it. I use it as CLI, the parameters being very simple to use (see script section). Avidemux is capable of cutting at the precise image, but is somewhat unstable, probably because the camcorders codecs are sometime weird.
There are three main linear video editors in openSUSE: Openshot, the simpler one (a much better version is announced for many month now, but not yet released), Cinelerra, may be the older one, pretty special, if you like it you like it a lot, but some time ago it was demanding clusters of computers (it don't anymore), so I didn't begin with it and couldn't cope with it afterward, and kdenlive, the one resembling the most the other OS competition. On the beginning I had to use Windows linear editor, because no one in Linux could cope with my needs, I used Pinnacle studio, Magix (very good), even Premiere, but for two years on, now, I use only kdenlive.
Film makers (I mean the sort of films using scenarios) are using large bunch of very short sequences, that are assembled in the linear editor. I know pretty well this world for various reasons, but do not use this myself, and I doubt most people having holidays shots use it.
So I guess you will have, like me, two kind of shots: short holidays ones, that needs to be shortened to remove ugly moves, or large show takes that may be as long as 5 continuous hours and that have to be cut in shorter sequences.
Linear editor kdenlive makes first kind of work a snap, and the second one nearly a simple thing also.
Some history and warnings
Time ago, I began editing videos with Studio from Pinnacle. I could try the demo version of Adobe Premiere and the timeline let me completely unable to use it. Studio used a "diapo" analogy that made it easy for a photographer to follow.
But I very soon needed a multitracks version, to be able to do sound dub. It's easy to understand that the place where you can shot the best video... is not the one where the sound is the best. Specially when shooting amplified music (live orchestras, rock bands...) one if often near the loudspeakers where the sound is incredibly strong and disturb the mikes.
Let me make a parenthesis to say that there are ears blockers specially made for musicians and that let in a nearly undisturbed sound, but much lower than the original. Mandatory if you want to hear when growing older.
This Studio version was a bit like the well known "Kino" Linux editor. But Kino didn't survive the end of the DV tape era.
As long as you don't need an extra track, openshot is probably the best editor - and may be when you read this the V2 will be available, but it's not when I write this. Anyway, the basic work should be similar with the Kdenlive one.
What is "linear video editing"
It's only a matter of pointers. For all the work, except for the final export, the software only works with pointers, despite it playing video and showing rushes. When you write the file (clic on "file save"), you only record a text file like this (open it with kwrite):
<?xml version='1.0' encoding='utf-8'?> <mlt title="Anonymous Submission" version="0.9.2" root="/home/jdd" LC_NUMERIC="fr_FR.UTF-8"> <profile width="1440" display_aspect_den="9" colorspace="709" frame_rate_den="1" description="HDV 1440x1080i 25 fps" height="1080" display_aspect_num="16" frame_rate_num="25" progressive="0" sample_aspect_num="4" sample_aspect_den="3"/> <producer in="0" out="32295" id="black"> <property name="mlt_type">producer</property> <property name="length">32296</property>
So you have to remember that the software have to find the real video file all the time.
But, when you work on the timeline, you can always change the start and end pointers, dragging the limit with the mouse, on probably every linear editor (limited by the file start/end).
Workflow, simple case
You just had to shot a gig, in a very small bar, where you could only drop the camcorder on a shelf and let it run all the evening, without any way to access it.
So you get a bunch of 2Gb files, may be MTS format (I use canon HF G10), may be for more than 3 hours total. I just did and got a gran total of 21Gb files.
You may at every moment, backup them to a BD disk (up to 25Gb available) or two.
What I will describe seems pretty complicated, but in fact the kdenlive part is very fast, only searching what is the part of the video to keep is long.
You will then do the repetitive actions:
- load the first file (or "clip"), from the clip box drag it to the timeline;
- read the file. Chance is the beginning is uninteresting, you will see the musician setting the gig. When the music begins, stop (space bar), may be go a bit backward (mouse);
- click on the clip on the timeline to select it, then press "shift R". This is the kdenlive shortcut for "cut" or "scissors". You get two parts, the first uninteresting part and the right interesting one;
- select the first part and press the "suppr" key on the keyboard to remove it;
- drag the remaining clip on the very left of the timeline. Never let a blank there it may either let a blank sound/video part or even crash the software...;
- skip to a place where you expect the end of the song (2... 5 minute?) and find the end;
- cut again (shift R). You get on left the interesting part and on the right the remaining of the clip;
- press "suppr", this remove the right part;
- be prudent, this moment is crucial. Save the clip to date-01. If ever you want to change something later to this clip, you will be able to do it.
- click on "render", choose a right place for the final file (beware, will be pretty big!);
- the first time, create a rendering profile (small icons). choose MPEG-4, video bit rate 12000, audio bit rate 192, full project. Do not change anything else. After that you will only have to select your profile. These settings are good for HD and music with a good ration weight/quality;
- click on "render to file" and "close". The rendering will take place in the background, you can continue editing! Be just warned than if something goes wrong and kdenlive crash, the rendering may stop (not always, depends of the crash reason). The computer will also slowdown a bit. Do not keep too many tasks in the background :-);
- to continue, press "Ctrl z" or click on the "undo" arrow. This will make the right part of the clip come again! save as date-02;
End of the task list. Go to the beginning and use the list again for the next song...
On the end, you will end up with one track for each gig song, ready to publish on BD or DVD, high quality.
Workflow, sound dub
Here you have to add an audio track and lip sync it to the main one. This have to be done if possible only once, or at least as little as possible.
The work is the same if you want to use two video tracks, it's most of the time necessary to sync with audio.
For this one have to look at the waveform of the audio track. In kdenlive, separate video and audio (split audio). Begin to remove all non necessary tracks. Here we will need one video track and two audio. Right click on left panel of the timeline and "Delete Track". kdenlive may crash, reload it. in the same left panel, upper part, you have to find two small icons: smaller or larger tracks. The larger the better, so also resize the timeline windows to make it higher -but keep image, it will also be useful.
When you load a large audio track, creation of the waveform may take some time, it's automatically done by kdenlive.
You should now have your 3 tracks (one video, two audio). When you split the audio, the two video and audio tracks keep grouped together, so you can move them left or right without losing sync. You should have anticipated the situation and made any kind of "clap", making it obvious where is the beginning of the usable audio. For a band gig, the beginning of the music is pretty obvious.
Move the cursor where you can see the band beginning to sing. If, like me, you take the sound from the main mixer, you probably started the sound recording first - my Zoom H2N can record 12 hours with two battery cells, my camcorder only 5 hours on one battery.
You should see like on the photo, the change on the waveform at the moment where the singers sing and the audience shut off noise. It's much more visible on the Zoom audio track than on the camcorder one.
You have to choose a zoom level that makes the waveform visible. Too small, all is black, too large the sine form is not enough visible. First time it may be very difficult for you to get sync. If nowhere one can see the singers lips, it's not really important, but if at a moment you did film a close up to the singer face, it's mandatory to have this part well synced, else many people will notice the problem or simply feel bad with the clip.
Be warned than no electronic hardware have really the same clock. It's unexpectable that you own professional recorders with overall sync (same clock tick for all the devices), so you will have to adjust the syn from time to time. After some work you will be very good and fast at this. You may also be disturbed looking at TV to see how often TV shows are out of sync (even said to be live shows). Most linear editors allow only the sync at the image step (1/25 or 1/30 of second). Sometime you will have to choose between two bad options: one image too early or too far...
I guess a musician ear is a great help. I'm not able to recognise notes, but I can make very precise sync anyway.
Two more tricks: you can mute any track (small icon on the left), specially to test where is some noise on what track, to select several tracks or bits at the same time, hold the shift key and move the mous pointer. shift R to cut and shift mouse to select are kdenlive special keys not found elsewhere.
Effects and transitions
I don't have time to speak about effects and transitions. Let me only say there are many. Just a word: to have a cross fade (very useful, its kdenlive name is dissolve), place the starting clip above the second one, overlapping and click on the green triangle that appears when the mouse is near the right bottom angle of the upper clip.
Using an online gallery
It's delicate because you have to take care both of the local archives and to the gallery setup. I still keep the videos and the photos on different folders. One do not look at a video and at photos the same way.
As for the photos, I use chronological order, but I can't use tags to sort videos. Modern videos files have metadata, but most common software do not use them. My Piwigo gallery do not.
I have anyway much less videos than photos, so adding some info in the filename itself is enough for me, but so the filename can be pretty long, like "20150417-gaz-christophe-01-new-york.mp4".
What format for what use
To see the video on home cinema, it's better to have HD 1080p one. So the mp4 12000/192 I use from kdenlive. But the files uses from 250Mb to 500Mb for each song, too much to be sent to the net with my DSL line (1 Mbit up).
So I have to shrink the files. One can still use an mp4 format, but this is not read by every browser. Browsers should read:
- flv format with the flash plugin. This is always read with the Adobe Flash plugin under Windows, but Apple do not like this format... Linux plugin is neither updated;
- mp4 is the Apple preferred one but not always read by Internet Explorer and Windows;
- ogg, the free format (in fact ovg) should be read everywhere, but it's not the case.
The two latter formats are used in the so called "html5" standard, but it's far from being already implemented, and using it may make it necessary to have two copies of the file (mp4 + ogg), so twice the size and twice the time.
Right now I still use flv. To use it in Piwigo, I have to create myself the folder tree and the thumbnails, so the script:
#!/bin/bash # echo usage: movtopiwi.sh *.mp4 # Faire d'abord detox -s utf_8 * mkdir piwigo ; mkdir piwigo/pwg_representative ; for a ; do b=`echo "$a" | cut -d'.' -f1` ; ffmpeg -i $a -s 640x360 -b 1000k -aspect 16:9 -ar 44100 piwigo/$b.flv ; ffmpeg -i $a -r 1 -t 00:00:01 -ss 0:0:10 -s 640x360 -f image2 $b.jpg ; convert -resize 128x128 $b.jpg piwigo/pwg_representative/$b.jpg ; rm $b.jpg ; done exit
The script creates the thumnails folder and fill it a bit at random with an image extracted 10s from the beginning. The video is resized on 640x360 and 1000 kb/s.
The script takes any input format or nearly and convert it. Size is approximately 1/10th of the original HD size.
Publishing as mp4 htlm5
#!/bin/bash # echo usage: movtomp4-html5.sh *.MOV mkdir html5 for a ; do b=`echo "$a" | cut -d'.' -f1` ; HandBrakeCLI -i "$a" -t 1 --angle 1 -c 1 -o "html5/$b.mp4" -f mp4 -O -w 960 --crop 0:0:0:0 --loose-anamorphic --modulus 2 -e x264 -q 22 -r 30 --pfr -a 1 -E av_aac -6 dpl2 -R Auto -B 160 -D 0 --gain 0 --audio-fallback ac3 --encoder-level="3.1" --encoder-profile=high --verbose=1 done exit