Diary of System Development
Part 28 (November 2016 ->)
I have been looking once more for a good text/code editor for my Android machines now i have a Samsung Galaxy Tab S2 8" which now has the screen size and resolution to make it possible to look at writing some of the content for our web site without a laptop.
The advantages and features I have now discovered are:
Overall it seems to be a very practical option for writing and coding - very similar to gedit or xed in usability provided it is used on a machine with a big screen and one with adequate power if one wants syntax highlighting on big files.
There is another option anWriter which has code completion and seems faster and previews .htm files but does not have word wrap yet which is a show stopper or shortcut keys and is only planned in paid version.
I have started producing some videos from the Sony Camera taken earlier this year and from the new Panasonic Lumix TZ80 camera I bought to replace the existing still and complement the video cameras. This has meant that I have had to relearn all about Kdenlive which has changed significantly (for the better) since I last used it a couple of years ago. The last time I did any serious work with videos was in 2014 when I did a serious archiving of all my existing recordings which were on VHS tapes (mostly commercial recordings), Video8 tapes, and MiniDV tapes as well as the more recent digital recordings from the Sony Video Camera bought in September 2013 which have all been recorded in in H264 720p MP4 format although it is capable of 1080p.
All the earlier recordings were converted to .mp4 files, the analog ones as a single big file and the digital MiniDV ones as individual clips within a folder. The MiniDV files were also concatenated into a single file for easy playing prior to editing.
Mostly singe file per tape captured under Windows and saved as .mpg (mpgv) 720x576 frame rate 25 and MPEG audio (mpga) for compatibility. These are stored in named folders under My Video/Video8 Capture/ eg My Video/Video8 Capture/1995 New Zealand/NZ95-1.mpg . Total 390 Gbytes. These suffer from edge artifacts which need to be trimed off.
These have been transcoded, de-intelaced and cropped of artifacts by Handbrake to .m4v files (H264 MPEG-4 AAC audio mp4a) typical resolution 704x578 for a display of 690x552 after triming which are typically <50% of the size and clean in appearance and are in stored in My Video/Video8 Videos/ typicaly My Video/Video8 Videos/NZ95-1.m4v suitable for viewing or as an input to an editor. 117 files total 185 Gbytes
Mini DV tapes are converted by Handbrake and are in form of My Video/DVnnn/DVnnn.yyyy.mm.dd_hh-mm-ss.m4v. There are 105 miniDV tapes labeled and in folders DV001 to DV105 for a total of 151 Gbytes
More recent Digital Video from Sony Camera and SDH cards are in My Video/yyyy/mm/dd/MAHnnnnn.MP4 where nnnnn goes from 00001 to 03007. Most of the folders also contain Sony 160x120 icon files with the .THM extension
Canon A720 IS Camera Video (640x480) are also in My Video/yyyy/mm/dd/ and the files are MVI_nnnn.AVI tyoe MJPEG 640x480 frame rate 30 with Mono PCM sound.
Vivitar Underwater Camera are in My Video/yyyy/mm/dd/ and the files are CLIPnnnn.AVI type MPEG-4 (XVID) 640x480 frame rate 30 Mono MS ADPCM sound.
Panasonic Lumix TZ80 Camera - bought partially for its video capability with EVF (eye level Electronic ViewFinder) integrated into My Video/yyyy/mm/dd/P0nnnnn.MP4 where nnnnn is part of same series as .JPG picture files.
Canon Camera SX610 - 720i HD and 1080i Full HD both at 30 frames/sec None integrated so far and probably little use due to different format but destined for My Video/yyyy/mm/dd/MVInnnn.MP4 where nnnnis part of picture series.
Samsung Phones None integrated so far but destined for My Video/yyyy/mm/dd/
The following is a part of the structure:
Kdenlive has become even better as a Video Editor since I last used it as version .9xx. Version 15 seemed very stable after I can converted my existing files whilst 16.08 currently seems a bit more prone to crashes although the automatic backups seem to have avoided any significant lose of work. Lets look at what one needs to be able to do to edit a Video and see how Kdenlive does:
The panel above comes from my earlier work in Ubuntu on the Take largely writen before my shift from video cameras using MiniDV tapes to Cameras using solid state storage nor did it take into account my earlier Video8 analog tapes. Again DVDs are almost a thing of the past and few laptops have a DVD reader and DVD players are no longer an essential in every home entertainment system. In exchange the importance of the internet and mobile devices has increased as has the push to wards higher quality 'HD' and 'Full HD' video and onwards to 4k video. So although Kdenlive could cover the first point and the last they are no longer prime requirements, in fact the first step with MiniDV tape input is best split out and done in stages by specialised programs which allow the input scenes to be converted into a more efficient format more suitable for editing and outputing. Note: The latest version of Kddenlive acknowledge that and the DVD abilities are no longer integrated.
The rest of the list can easily be done by Kdenlive, much is intuitive but there are many shortcuts or tricks to make the process very efficient. There are also some facilities which would be very useful even if they do not all currently work fully including a mechnism to split a file into scenes based on content as well as time codes which would be extremely useful for the Video8 tapes where the scenes have to be manually split for editing.
This is probably the most demanding test of the video processing culminating in kdenlive
They were initially captured via an analog input using Pinnacle Studio DVplus software running under Windows Vista in circa 2007. This was before I converted completely to Linux and the Studio DVplus/Studio 10 were good editors at the time when I was initially working on my MiniDV videos. The format used was similar to that of MiniDV tapes as the intention in both cases was to create DVDs which use a subset of MPEG-2 at 720x576 with a pixel aspect ratio of 16x15 to give an aspect ratio at 4x3 at a display rate of 25 frames per second, interlaced. The audio is MP2 (MPEG Audio Layer II).
These files were latter (2014) transcoded using Handbrake to H264 reducing down to circa 1.8 Gbytes per hour. At the same time the size was cropped to 590x552 which, with a pixel aspect ratio of 16x15, retains the aspect ratio at 4x3 to a high degree of accuracy. The video was de-interlaced in Handbrake so it is progressive and the conversion to H264 has also led to a conversion of the PCM audio to AAC at 160 kb/sec stereo. The end result of this is that the Project Settings should use a SD/DVD Profile at 25 frames/sec., or one could create a special non standard profile for the 590x552 size.
The following screen grab shows the input clip properties and the project settings I have chosen to match.
and the settings for rendering are:
The rendering rate on my Defiant is circa 24 mins per hour of input video with the above settings and the resulting video occupies 1030 Mbytes/hr is considerably lower than the original 13 Gbytes per hour or the intermediate 1.8 Gbytes/hr and a very good match to the original Video8 video in quality. I did not experiment with the video quality setting but 18 is probably on the low side. Using 23 gives about 470 Mbytes/hr and may not impact the quality greatly if you want to minimise the sizes. NOTE: I have noticed one needs to change Auto to Force Progressive to force a progressive output.
The Sony information states this is 1280 x720 pixels at 25 frames sec progressive quality , H.264 6M with AAC audio 384K (~3 Gbytes/hr). I have run a number of experiments on the settings in the rendering profile and a quality setting of 18 copes close to the incoming video bitrate of 6000 kb/sec and gives approximately 5500 kb/sec. The incoming stream has an audio bitrate of 128 kb/sec rather than the 384 quoted by Sony so the output bitrate has been selected to be the same. The measurements were made by using the internal properties screen for the incoming stream and the output using the same screen on a rendered video added back into the project bin. I found that the audio bitrate did not seem to be set correctly so I edited the ab= value to be 128k and also set up profiles with ab=160k and 192k. I did various tests of rendering speed and the medium setting on encoder speed seemed to give reasonable speeds and a slight improvement in video bandwidth. I am set to 8 threads but the setting seems to be ignored as changing to one thread makes no difference in the cores in use as displayed in my system monitoring.
Rendering with quality set to 18 and 128 kb audio gives at medium rendering speed a video bandwidth of 14050 kb/s and 6.5 Gbytes/hr data when the rendering is using the medium speed preset. Medium speed is 165% real time and 85% with the faster rendering preset. Faster at 18 gives video bandwidth almost the same at 13935 kb/sec and a fractionally smaller file size. Quality 19 gives a video bandwith of 12000 kb/sec. Quality 18 gives a video bandwith very equivalent to the 18 for the 720i from the Sony camera as (1920x1080)/(1280x720) = 2.25 so is probably a sensible standard to use but with the faster rendering preset as there is extra quality in hand. Quality 16 is required to fully match the Full HD input video stream at 20000 kb/sec if one has really fast action.
Constant Rate Factor is simple to use and targets a quality level and tries to maintain it over the encoding. The -crf value range is from 0 to 53 (or 63 in 10bit mode) and maps to the same range of the quantizer, ideally it would provide the same perceptual quality of the constant quantizer rate-control but in less space by discarding information human eyes would not perceive. As rule of thumb every increase by 5 halves the bitrate, 0 being lossless encoding. I have experimented in the range of 16 to 22 to match the video inputs and 18 seems a good compromise. Note the Kdenlive slider settings only give 15, 23, 30, 38 and 45 so the use of the 'More Options' box is essential and it is best to create a new profile with better options.
The encoder presets are ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow, placebo. There is the option of additional tunings which are film, animation, grain, stillimage, psnr, ssim, fastdecode, zerolatency. Only a subset is available through Kdenlive.
Each preset is supposed to be about twice as slow as the previous but this does not seem to be the case when used through Kdenlive.
The Profile needs to be that of the most common input and the rendering should be the same. The new Canon SX610 can be used for video although that is not the intention. It records at 720i and 1080i in H264 (MP4) but at 30 frames/sec. I have done some experiments and Kdenlive seems to be quite happy to work with mixed inputs and render at H264 25i. I have checked the output is transcoded to 25 frames/sec and runs at the correct rate! I have not checked the audio with a quality input.
I have gererally rendered at the audio bitrate of the input stream but will increasee that if I add a high quality audio track to 192kb/s or 384kb/s to match typical CD and MP3 sources.
You can now reliably add multiple selected clips into the Project Bin, 200 now seems to be no problem.
You can drag (multiple) clips from the Bin to the timeline, again several hundred.
You can make and edit titles which then live in the Project Bin and can be saved for further (re)use in a folder - I use titles as the folder name and keep them in the project folder.
There are three tools for working in the timeline:
Remember to return to the standard Select after using the other tools..
There are now (since 15?) three modes which allow for three point editing, ie inserting into the timeline and making space or cuts to do so.
You can use the mouse wheel in the timeline ruler, timeline and zoom bar at bottom write to control the display
There are many useful shortcut keys to make accurate movements down to a frame at a time. See https://userbase.kde.org/Kdenlive/Manual/Useful_Information/Shortcuts
Before proceeding further I should mention snap which is crucial to the effective use of kdenlive - it should be on but can be toggled in the little toolbar at the very bottom right.
When this feature is on, dragging, for example, the beginning of one clip near to the end of another will result in the end of the first clip snapping into place to be perfectly aligned with the beginning of the second clip. As you move the two ends near to each other, as soon as they get within a certain small distance, they snap together so there is no space and no overlap. Note that this occurs even if the clips are on different tracks in the timeline. This occurs with almost every type of drag or positioning operation on clips, cursors, guides effects, transitions etc., and is how everything ends up accurately lined up when using the mouse.
The timeline cursor shows your current position in the project. The positions of the cursors on the timeline ruler and Project Monitor are always in sync. Position can be moved in following ways:
A zone can be selected in a clip or in the project and is required for certain activities such as setting up a region for preview video. The zone is displayed at the top of the timeline under the timecodes and in the project monitor. As far as I can tell the zone can only be selected in the project monitor using the Set Zone In (I) and Set Zone Out (O) buttons or in the timeline by shortcut keys I and O.
The is a good tutorial from kdenlive at https://kdenlive.org/project/editing-audio-volume-with-keyframes/
You can also see the full list and set up new shortcuts by Settings -> Configure Shortcuts. I have (re)set up two extra shortcuts :
Select a Clip in the Project Bin -> Clip Jobs -> Stabilise ceates a 'clip' with .mlt added which you can drag to the timeline. There are a huge nuber of parameters and there is information in the Kdenlive Stabilisation Help
I have only used the defaults and it does seem to help a lot on flying videos despite the camera Image Stabilisation already present. The examples in the above reference are almost unbelievablely effective.
Now one needs to see if it is working. The best way is to set up a split screen of some sort by putting the stabilised and unstabilised videos below each other and using the Composite and Transform between them. In the simplest case you can just use the opacity setting to give a shadow of the old or you can add Position and Zoom Effects to each and scale to 50% and shift one sideways so you have a side by side comparison. You may need to use preview rendering to get a smooth view.
This has unfortunately shown that the stabilisation has had some unfortunate results in places on my flying aircraft videos so needs to be used with extreme care.
This is very useful if you have some video where parts are impossible to stabilise but you want to retain the audio track or just to turn it into a still [under a title].
This effect causes the video to freeze. If you add the effect and leave both check boxes unchecked, the clip will be frozen for its entire length. To change this, check either the Freeze Before or Freeze After setting and move the Freeze At slider to the time where you what the freeze to start or end. If Freeze Before is selected, the video will be frozen at the start and then start moving when it hits the Freeze At time. If Freeze After is selected, the video will be moving at the start and then freeze when it hits the Freeze At time. The audio in the video plays for the entire length, i.e. the Freeze effect does not alter the audio.
This is a new and very useful feature in Kdenlive 16.08. Again it is not implemented in an intuitive way but it is essential if one wants to look smoothly at complex effects in high resolution videos.
This only partially works which is a pity as it would be very useful for my early analog videos. It does seem to do something but the most I could make work was the analysis which seemed to generate split positions in frame number and possibly a confidence figure.
This is an important addition in version 15 of Kdenlive but it is implemented in a complex way which is difficult to find and understand. I feel I have to refer to the Paper in the Kdenlive Toolbox on the Library which makes it reasonably clear. In Summary
The latest version of Kdenlive are quite different in many ways tothe previous versions I used which are versions .9x and many of the helpfiles and tutorials do not seem to have caught up which has meant that to some extent, I have had to experiment to findout the latest file usage and default folder locations. Kdenlive version 16.12 now locates its cache files in the Project Folder in a folder with a random 12 number name.
The subfolders are audiothumbs, videothumb and preview . Preview is a new feature.
These new caches can be cleared from within Kdenlive by Project -> Settings -> Cache Data and those still required will be regenerated if you re-open the project.
I have also found .cache/kdenlive/proxy/ which may contain the proxy files but I suspect they are now stored stored in a sub-folder within the project folder but I can not confirm that until I test it by using a proxy but Project -> Settings -> Cache Data has an option to clear it wherever it is! The old cache could always be deleted and would again be recreated and re-populated if required
There is now aConfig file which is .config/kdenlivec.
If you find that you settings are in a complete mess (such as being locked into full screen mode which happeded to me), it is possible to delete this file and you should be back to a basic new system but you will have to reconfigure everything including shortcuts, default folders etc.
So my Project Folders for the latest versions of Kdenlive 16.12. or higher is called Kdenlive and lives on my DATA partition (/media/DATA/Kdenlive) which contains sub-folders namely:
A folder I have created called Library to hold the kdenlive library - see below for setting default locations.
Folders for each Project with each containing:
Project files (.kdenlive) - these have multiple copies as I keep saving with increasing version numbers for security
A folder I have chosen to create called titles containing all title definitions (.kdenlivetitle) used in the project.
A folder I have chosen to create called pictures containing all custom pictures used in the project such as extracted frames and all other pictures not in My Pictures folder structure.
A folder I have chosen to create called rendered to contain rendered video. I also use a higher level folder called Rendered Video for more general rendered video.
The kdenlive project now also generate folders in the project folder - it always seems to generate one called .backup and I also have some called proxy and one called selections but they may be from an earlier version as well as the random numeric named folder containing the cache data.
The kdenlive project may also generate files, for example files with a .mlt extension with information on how to stabilise a video clip and, in this particular example, they are in the same folder as the video clip being stabilised.
I have deleted the folders called thumbs which no longer seemed to be used as it is replaced by folders in .cache/kdenlive in ones home folder
One needs to set up to use these default folder locations by Settings -> Configure Kdenlive -> Environment -> Default Folders where I have
The following shows a typical part of my folder structure where MRF is a project folder and Warbirds, Mediteranean_Wonders_2014 and Lisbon are further project folders. Library is the folder containg library items and is the only folder other than project folders directly beneath Kdenlive.
The folder Kdenlive can live anywhere as it contains all project specific files, the cache is a defined location in the home folder and all the 'input' files are defined to be in absolute locations in /media/DATA/My Videos and /media/DATA/My Pictures
If the input files are missing kdenlive does a search and/or asks for their new locations - I have checked that works for Video files. It may also be possible to create links (not tested)
My belief is that it should be possible to synchronise /media/DATA/Kdenlive, and /media/DATA/My Videos and /media/DATA/My Pictures between machines and everything should continue to work although it may take a while to recreate the thumbnails and other cached files. The project and kdenlive settings would also ideally need to be the same.
One can switch to console with CTRL+ALT+F1, log in, and type commands as usual to get out of a lockup of some form or kill a problem program using killall ie killall cinnamon-screensaver. Use CTRL+ALT+F7 or CTRL+ALT+F8 to get back to your session.
This is very useful to search for use of programs etc when using Git
grep -rl "searchstring" .
Note the . (dot) at the end which could also be any /path
More interesting options at https://askubuntu.com/questions/55325/how-to-use-grep-command-to-find-text-including-subdirectories
I would be very pleased if visitors could spare a little time to give us some feedback - it is the only way we know who has visited the site, if it is useful and how we should develop it's content and the techniques used. I would be delighted if you could send comments or just let me know you have visited by sending a quick Message.
|Copyright © Peter and Pauline Curtis
Content revised: 28 th August, 2018