BIPEDU

my ideas in action

Category Archives: free time

use ffmpeg to edit videos

I want to show here how to produce a video and what are the steps to post-production.

All these are using free and open source software. No need to be expert in computers , only a little bit of courage.

You can use this recipe for homemade videos that you post online, for your vlog/blog or whatever.

I use ffmpeg and Inkscape that are available for Linux and Windows also.

As a general rule, if you have Linux/Unix, then please use the RAM since it is faster (read/write in /tmp folder always for all temporary files).

 

These are the steps :

1= record the video + audio

use a decent camera (preferable HD or 4K) with preferable audio . DSLR is OK also.

If your camera do not have good audio recording from builtin mic, then record the audio separate and clap in front of camera so that you can synchronize video/audio in post-production. Preferably use an external microphone ( ex. lavalier) as close as possible of the sound source. A cheap and good lav mic is Boya BM-M1 (see Amazon)

You can also record with a smartphone but be aware that the sample rate may be 44100 instead of 48000 as camera will record. This may produce audio that is not in sinc with video.

During recording please keep 5-10 seconds of silence , because you may need it later to do some noise reduction (see next step)

2= extract the audio separated and do some processing (if necessary)

Personally I use Audacity ( free and open source) .

I import audio and I do mainly two operations : Noise reduction and Compression. I use default settings from Audacity .. are ok for most cases. In case the audio sample rate is on 44100 then it is preferable to change it to 48000 to match the video.

Save the audio as WAV ( 16bit) in 48000.

3= then replace the video old audio with the new audio (new audio is with noise reduction)

3.1 = strip the audio from the video

ffmpeg -i /tmp/DSC_0009.MOV -an -c:v copy -c:a copy /tmp/p1.mov

3.2 = add new audio to the video

ffmpeg -i /tmp/p1.mov -i /tmp/DSC_0009.wav -vcodec copy -acodec copy /tmp/p2.mov

 

4= cut the video to the correct size

play first the new video and check the quality and note on paper the moments you want to save. For example : from 00:01:12 till 00:25:48 (hh:mm:ss format)

use example : cut from 20 sec till 9min and 36sec :

ffmpeg -i /tmp/p2.mov -vcodec copy -acodec copy -ss 00:00:20 -to 00:09:36 /tmp/p3.mov

5= (optional) add some logo/title/watermark

5.1 = Create the logo

With Inkscape (free and open source) create a image that has the same format as the video. Example if video is HD 1920*1080 then create a page that is 1920*1080. On this place your logo/watermark / artwork and preferable use alpha (transparency) to get more effect. Save the work and export it to PNG and keep the transparency.

5.2 = Overlay the PNG image to the video with ffmpeg

ffmpeg -i /tmp/p3.mov -loop 1 -i /tmp/TitleFile.png -filter_complex “[1:v]fade=in:st=0:d=0.1:alpha=1,fade=out:st=9:d=1:alpha=1[png];[0:v][png]overlay=x=0:enable=’between(t,0,10)'” -b:v 2000k -bufsize 2000k /tmp/p4.mov

Here I overlay the PNG image from second 0 ( st=0) in 0.1sec (d=0.1) and then fadeout starting at second 9 (st=9) for 1 second (d=1). The entire overlay is from seconds 0 to 10 ( see : between(t,0,10) ). Then I also force bitrate to be 2Mb/s (-b:v 2000k -bufsize 2000k) to avoid too much loss of quality. If not the ffmpeg will reduce the bitrate even more and it may be too low.

 

6= (optional) add a static picture at the final with credits/ links/Thanks or other announcements

6.1 = use Inkscape to create a closing image. Same as before, can use transparency (alpha) .

6.2= use ffmpeg to create and concatenate the image at the end of the video:

ffmpeg -i /tmp/p4.mov -loop 1 -framerate 30 -t 5 -i /tmp/Closing.png -f lavfi -t 0.1 -i anullsrc=channel_layout=stereo:sample_rate=48000 -filter_complex “[0:v][0:a][1:v][2:a]concat=n=2:v=1:a=1” -b:v 2000k -bufsize 2000k /tmp/final.mov

options :

framerate=30 : need to match the original framerate of your video ( if you shoot in 60FPS then use 60 here also)

t 5 : generate 5 seconds video that will show your Closing.png image

stereo : add stereo sound if youd video is stereo ( if not you can put mono)

sample_rate=48000 : use the same sample rate as your audio (other option is 44100)

 

7=(optional) post the video online ( Ex: Youtube, Vimeo……etc)

 

 

Advertisements

new lessons on analog CMOS design

Recently I’m working on some free lessons / courses on electronics.

More specifically on custom analog CMOS design.

I think is better to share my knowledge with others. I try to present detailed design with accent on the principle, methods and trade-offs.

My first is about designing a CMOS analog opamp , with full rail-to-rail inputs and outputs.

I go from easy to hard and I hope to be easy for everyone to understand reasons and the decisions that are made during design process.

 

For the moment I have only few 10 minutes video…. I will add more soon.

 

Good movies

Miss Sloane

Contratiempo – Spain 2016

Gone Girl (2014, with Ben Affleck) – tension, thriller

 

for all spammers in the world !

How to watch Half-SBS movie in red/cyan 3D movie ?

I noticed that on torrents there are more and more 3D movies available. I think that soon this will be the new standard.

But as many people may know , the majority of TV on the market are working with anaglyph format. This Anaglyph format is in fact the well known red/cyan standard. Many cinema theaters use this standard and many are familiar with the sully red/cyan cardboard glasses.

But what to do when the movie you have ( ex from torrents ) is in side by side format ?

First of all what is side-by-side format ? Well it can be recognized by the fact that when you open it in VLC or other player you see 2 images instead of one.

This is an example :

This format has many variants like Full side-by-side, half side-by-side, it is often visible in the file name like FSBS or HSBS or Half-SBS. Or simply SBS or “side-by-side”.

To watch this kind of format on a classical 2D screen ( PC screen, or TV or projector) is a drama since the people have pointed heads and the image is 2x times.

I noticed that some people recommend to use player option to separate the images and then to re-size the screen to 16:9 format.

This is a bad idea since is hard to setup and you loose part from image.

A better solution is to use a 3D player ! Yes there are 3D players for ordinary 3D/2D screens  (pc monitor or TV or projector)!

A 3D movie player I tested recently is Bino. It play any 3D video format and it has a lot of options to find the optimal 3D experience for your screen but also for your eyes.

So basically if you have a red/cyan glass you can see a 3D movie directly on your PC screen or even on classical TV.

Bino is available for Linux, Mac, Windows and many more !

Something important ! Please use the 3D hardware acceleration to see this kind of 3D movie since even a i3-i5 Intel CPU may have problems…

Fetih 1453 – propaganda movie – review

Fetih 1453 - movie poster

 

Recently I saw the Fetih 1453 movie. For the people that do not know what is this … well, it is a historic movie made by Turkish cinema about the conquest of Constantinople in 1453. It is full of special effects and it aims to revive the Ottoman glory.

 

The story is set in the 1453 (and few years earlier). The movie start with a prophecy that a strong ruler will rise and the Ottoman Empire will be the biggest. Then continue with some background of the historical and personal aspects of Mehmet sultan. Then for almost 1 hour the battle of Constantinople.

The movie is very long, approx 2.5 hours. It has some action scene but also some boring scene.

I think the director of this movie wanted to show too much in too little time. So it give the impression that is a gathering of scenes and episodes and it may be hard to follow for the people that do not have historical background.

 

My personal remarks are mainly about the historical accuracy of the events and the propaganda and Turkish heroism.

I want to remark first the clear difference and superiority of the Turks in compare will all other nations ( Byzantines and Vatican ). In may scenes the byzantine emperor is shown in company of party girls while the sultan is only with his wife and kid. The images are idealized so that it will look very patriotic. The amusing part for me was that the sultan had time to write poetry to his wife as a goodbye gift before going to war. I do not doubt the fact that the sultan may write poetry , but the scene was exaggerated.

Then the scenes in which the sultan fight with sword or hunts with bow and arrow… please.. it looks better that in the Robin Hood propaganda movies ! Basically , to be short, this propaganda movie want to show that the sultan was perfect: best soldier , best father, best husband ( where is the harem ??) best politician, wise, patient and stubborn. Too many qualities for a single person. If we read some history we see other things. But I will not enter now in the polemic with this propaganda movie.

 

The other important scenes are the ones with Byzantine people, from simple people to the Emperor. The decoration are somehow realistic, but it is visible that the historical truth is “modeled” for the Turkish viewers. The byzantine rooms look big but miss essential decoration, like icons, mosaics, colors, crosses. It may be understandable that do to limited budget this details are lost. Or maybe do to Muslim rules it is not pleasant to show crosses or other orthodox symbols. Funny thing is that the actors say many bad words to the “turks unbelievers”. So the Turkish viewers are motivated to hate the byzantine enemies 🙂

 

The scenes with Vatican people ( Pope and his followers) are also realistic. It is showing one true historical truth: the fact that Byzantine empire was in danger not only because of the turks but also because of the Vatican then wanted to impose the Catholic reign over Orthodox Church. And the movie show a real tension inside the Orthodox people that were more afraid of Catholics rather than Ottoman enemy.

The funny part was that in all scenes where the Pope was blessing his cardinals, the Pope made the cross like Orthodox and not like Catholics. It is a small detail, but it may rise questions if the movie is shown to Christian people. Probably for Muslim population it is ok, since they may not know the difference.

 

Then about the big cannon. Indeed this was real and was the main reason the Turks breached the Constantinople walls. But the romantic story is exaggerated. I mean the girl for that role is too ugly to start such a romantic affair. I do not understand it ! Turks have such nice girls and they choose one ugly girl, for such a big role.

The scenes with Crusaders murdering her family are strange since the girl should have hatted Catholics ( Crusaders) and not Byzantine people. But again I think that here is intended confusion between Catholics and Orthodox people made on purpose just to emphasize the movie plot.

 

The final scenes are completely out of historic sync, since the Turks enter peacefully in Saint Sophia Church and nobody dies. Even the Sultan kiss a small girl. Please ! the history say then after days and days of slaughter the sultan said that the building should not be destroyed but transformed in mosque ( probably he was thinking that it will cost too much to rebuild it from scratch),.

 

So my opinion is that this movie was made for pure propaganda and mainly for the Turks viewers.

It is actually a big trend in Turkey to revive the old Ottoman memories and to search for the former glory.