Posts Tagged ‘Beer’

Console Video edit Rotate, Merge, Scale, Trim add background music to Video files on Linux and UNIX with ffmpeg

Tuesday, June 18th, 2024

https://www.pc-freak.net/images/linux-video-edit-few-basic-tricks-edit-cut-combine-put-background-music-to-video-on-like-os-unix.png

GNU / Linux and other Free as in Beer OS-es such FreeBSD and OpenBSD as well as other UNIX variants are definitely not the best platform to do Video edit, as the best one is obviosuly MAC OS-es for being a veteran in the field of graphic edit for a long time but over the time its capabilities are slowly but surely evolving. 
However Linux users can also do the basic video edit stuff quite easily with ffmpeg and few other tools.
 The general things one faces when snapshotting videos is the video might be turned around or in the wrong angle and you want it to rorate, or you have two three or more video files and you would like to merge the ones in one or you would like to Trim a period in the beginning of a Video or Trim some time you don't need out of the video at the end end, merge multiple MP3 files into single recording or including a background music to a video.

Doing such a things has a lot of possibilities with tools such as ffmpeg, imagemagick and mencoder and it is mostly useful if you're a console guy or you need to write a program that does video rorate or video merge in PHP / Perl / Python etc.
 

1. Rotating Videos in Linux

Rotate a Video in 90 degrees

Rotating a video assuming that you have the ffmpeg tool installed is as easy as:

# ffmpeg -i in-video-file.mov -vf "transpose=1" out-video-file.mov

Supported value arguments for ffmpeg ranspose option
0 = 90CounterCLockwise and Vertical Flip (default)
1 = 90Clockwise
2 = 90CounterClockwise
3 = 90Clockwise and Vertical Flip


2. Flip the video clip Vertically

# ffmpeg -i out.mov -vf "vflip" out2.avi


If you don't have ffmpeg, just install it with apt or yum:

On Debian 

# apt install –yes fmpeg


On Redhat based distros

# yum install -y ffmpeg

ffmpeg is easily installed by bsd ports with the package manager for example on FreeBSD it is up to :

# pkg install ffmpeg


3. Merge (Concatenating) Videos with ffmpeg / mencoder / avimerge on Linux

Go to the directory containing all the videos you would like to merge and merge them with belowsimple one liner:

# ffmpeg -f concat -i \
<(for f in $PWD/*.avi;do echo "file '$f'";done) \
-c copy output.avi


To merge multiple set of lets say ( sequential ) Video files on Linux with mencoder and produce a single video file:

# mencoder -oac copy -ovc copy 1.AVI 2.AVI 3.AVI 4.AVI -o Single-common-out-video.avi

mencoder is available also by default on most distros if not install it with:

On Deb based Linuz:

# apt install mencoder –yes

On Fedora / CentOS … rpm based:

# yum install -y mencoder

The old and now obsolete transcode audio / video converter could also be used:

 # avimerge -i file-input1.avi file-input2.avi -o output-file.avi


4. Scaling a video to a concrete resolution

It might happen to you that some video files could not be concatenated with other video file because its resolution is smaller (or different) than the recorded material,
to come around this you need to scale it.

# Scale video resolution to 1920×1080 pixels

# ffmpeg -i input-video.mp4 -vf scale=1920:1080 output-video.mp4


5. Trimming the beginning of a Video with ffmpeg

A recording will often contain parts in the beginning that you don't need and have to beto be removed from the video stream:

# Remove the first three seconds (Common scenario)

# ffmpeg -i input.mp4 -ss 3 -c copy output.mp4


6. Trimming the end of MP4 video with ffmpeg

The same is true for the end of a video materials often:

# Remove everything after 5 minutes and 32 seconds

#ffmpeg -i input.mp4 -t 00:05:32 -c copy output.mp4

Both, -ss and -t, can also be combined into one command.


7. Adding Background Music to a Video with ffmpeg

To add a concrete background music to a video stream, track the volume had to be lowered first:


7.1 Reduce the volume MP3 music file by 50% with ffmpeg

# ffmpeg -i input.mp3 -filter:a "volume=0.5" output.mp3


7.2 Combine multiple audio tracks into one single recording stream

# Concatenate multiple mp3 voice files into one
# ffmpeg -i "concat:input-song1.mp3|input-song2.mp3|input-song3.mp3" -c copy output-concatenated-single-song.mp3

One thing to consider is that once you want to add a background music stream to a video stream, both the video and the song has to be of the same length, otherwise attempts to merge the background audio track with fail
 due to the length of the audio track not matching the length of the video.
This can be resolved by generating a silent audio track and concatenating it to the end of the audio track to make the video and music match:

# Generate 33 seconds of silence
# ffmpeg -f lavfi -i anullsrc=channel_layout=5.1:sample_rate=48000 -t 33 output.mp3


Finally, to merge the audio track into the video track:

# Merge video with existing audio track and another audio track

# ffmpeg -i input.mp4 -i input.mp3 -filter_complex "[0:a][1:a]amerge=inputs=2[a]" -map 0:v


Sum it up what learned

In this article was shown how to convert multiple Videos into a single one, scaling a video to a graphics resolution, trip a video at the beginning and at the end, add background movie tracks as a sound on Linux.
As you can imagine this stuff is quite useful and used by many, many websites online to do a different Video and sound editing included in a millions of Frontend / Backend webscritt Scripts around silently doing its stuff.
There is much more to be done with this tools, but for a starter of a video edit newbies it should on Linux and enthusiasts to manage own managed small private clouds, hope this stuff will be useful for a introductionary.

Cheers ! 🙂 

Life going nowhere …

Sunday, September 23rd, 2007

Meaningless_life-picture

Seems, My life is going nowhere. Today I drinked half of a bottle of Wine and 1 beer. I was out with Alex. We drinked in the city park. Through the day I started my first bsd jail using a tutorial online. I smoked a lot of cigarettes and I want to stop them again. Most of the people I met are not a good company for me that's what I'm thinking more and more. Also I'm thinking more and more I have to change my living place. If only I could find the love of my life … We moved bookshelf and stuff from our room ( My mother again has decided to make repairs in our room. ). I'm asking myself why shall I live a meaningless life. At least my interest into computers and computing started to appear again (this is cool). My faith is really going away since I pray and pray for something .. and I don't receive it ( Or at least I don't see it). I'm tired of waiting. I need to have this physical healing to continue my normal life. I'm not proud of me I was a little aggressive when we was in the Mino's coffee before an hour or so … Now I intend to watch another episode of stargate SG1. And to go to the DreamLand. If only I could live into a Dreamland all the time. I'm starting to realize I should change the music I listen, I should change a lot of my behaviours If I want to have a new and happy life. Autumn is a beautiful Season 🙂 The autumn rain shall come and restore us :)END—–

Sick again – Hoping God to solve it all – and no desire to study

Thursday, September 27th, 2007

Yesterday I was out for a coffee with Tony an old frined from the Old metal days, after that I went outwith Lily I drinked 200 gr of Vodka and a Beer. I was pretty desparate actually and I got very drunk I got home 04:10 and got to bed at 4:30. What can I say life is hard. Today Mitko called at dinner time and we drinked a coffee on the fountain. The night we went out in the Central park and drinked a beer per man. I’m starting to think about the meaningless of my life again, since my life seems without a real purpose and seems not going nowhere ( we humans are so weak ). Yesterday I have almost taken the decision to suicide. It almost a miracle after I send lily to her home and was going back home with the idea of my mind to suicide. Lily called and said she can’t unlock the door and everyone inside is sleeping and she didn’t want to disturb them. So we spend more than an hour outside. Today I feel terrible physically again. I really can’t take it anymore I need Jesus to bless me with a healing (Save me Holy Lord, Lord Jesus son of the Blessed God have mercy over me the sinner heal me Lord and Deliver me from all sickness and affliction and pain Heal my Soul, Body and Spirit, make me whole to be able to serve you again :[ Amen) My computer went down twice today I have a problem with the cooling. The cooler should be cleaned but I guess this will happen after our Room’s repair is completed. By the way Both Pc-Freak and Jericho are on the terrace. Because repair works are being done into the room. Day after day I ask my self the question when I will be healed again. I do smoke a lot of cigarettes for which I’m ashamed of myself (But it’s an act of desperation). By the way I don’t have any desire to study anymore I’d like to do things with FreeBSD and learn stuff. If God is merciful to me and heals me probably I’ll continue to live otherwise I guess I’ll end badly. Very often come to the point Nobody out there cares, them I feel the presence of God’s spirit I remember the Bible’s instruction towards doubtful mind and try return back to the Faith of the Eternal, It’s like a sort of schizofrenia (I believe, I don’t believe). I’m sure both cannot be true. Very often I think I deserve more but since God’s rightous probably that’s what I deserve. I tried do good for so many people and to care for as much people I’m very discouraged because as a reward I see it like receiving this infirmity and sickness … Something have to change or I’ll be gone …END—–

Prodigy night and Spirit of Burgas 2012 – few impressions

Tuesday, August 7th, 2012

The Prodigy Spirit of Burgas 2012 - How to steal a jet fighter latest prodigy album

As a kid I have been very big fan of The Prodigy. Prodigy were considered absolutely revolutionary style band in the 1995 – 2004 years. As an ex-big fan of the band and cause of the fact I happened to be near to Burgas I decided to attend their performance on August the 5-th.
Spirit of Burgas as every year happens on the beach of Burgas.

A large number of nice underground rock / punk / jazz / reggae etc. continuing for days is not so common on the balkans so Spirit of Burgas is quite a unique undeground music gathering …
Spirit of Burgas is taking place now for a 4-th year and starting to become an established Electronic, Dance, Metal feast here on Balkans.

Below is a list of all the bands that played on Spirit of Burgas 3 days feast this year;
Spirit of Burgas year 2012 bands agenda for 3 days list picture

The 1 night entrance fee was quite expensive 40 EUR, but for a famous band as Prodigy and the rest of bands bands playing on other beach scenes I guess the price was fair. The 3 days entrance fee worth it money much more though, for 3 days ticket the price was 60 EUR. The beer price too high; 1 beer price was 1.60 EUR. For a richer countries this prices are nothing and OK but for the low salaries in Bulgaria the beer price was killing.

Besides the high price, the only beer one can buy on the beach was Becks (taking me out the choice to buy another beer brand!). Everywhere around was those annoying writings on both billboards and video sceens B’ECKSPERIENCE, Jack Daniels, DSK Bank etc. Advertsiments should be but this was a bit over-stretched!….

Prodigy performance started about 10:30 on the so called Main Stage – a big scene facing the sea. Prodigy break out and enter, the scene right after a performance of modern punk band SUM 41

I don’t know the music works of SUM 41 that’s why I skipped most of their concert checking the other stages perf-s. On most of other stages mostly Bulgarian Punk / Rock / Alternative musicians were playing.
Prodigy’s scene break-up was done with some famous buzzling sounds known from their works, as you can see from the videos I post below.
The Stage was very over-crowded, according to some estimations the concert was attended by about 15 000 people ! ! !. Considering the decay in Prodigy popularity I guess this was quite a good number.
During The Prodigy‘s play all the other scenes were shut off in order to allow everybody to enjoy Prodigy.

I should admit, the music beats and ruffs were just great, but I didn’t liked the vox messages “Keith Flinth”, was spreading; Saying some iditic phrases like:

Where is my People?, My Prodigy People, My Voodoo People and plenty of other non-sense

As a Christian I know pretty well Prodigy’s music message is not in consonance in Christianity and hence I didn’t liked to be associated as a “prodigy person”, cause I don’t want to be associated with people who preach evil. Something else, showing off the low prodigy vocal culture was his frequent use of the F*CK word, which btw was probably the most used word by almost every musician playing on every scene all night long…

The scene lightning was rich but not bright, enough to clearly distinguish what is happening on the scene.
On the back stage, there was the name of latest prodigy album – How To Steal a Jet Fighter with a background of an old jet fighter plane.

Prodigy Vocalist Keith Flinth on main stage spirit of burgas 2012

The group scene performance was quite aggressive as always, actually probably it is the primitive behavior of the band and the primitiveness in music that attracts the crowds. People nowadays are too much civilized that the wild primitive deep in us is something we hardly miss as ppl.

The Prodigy in the beginning @ Spirit of Burgas 04.08.2012

The Prodigy – Breathe, Live @ Spirit of Burgas 2012

Prodigy Spirit of Burgas 2012 Black Sea Party Zone 1

The Prodigy Spirit of Burgas 2012 Black Sea Party Zone 2

Prodigy Spirit of Burgas 2012 Black Sea Party Zone 3

Prodigy Spirit of Burgas 2012 Black Sea Party Zone 4

Prodigy Spirit of Burgas 2012 Black Sea Party Zone 5

Prodigy Spirit of Burgas 2012 Black Sea Party Zone 6

Prodigy Spirit of Burgas 2012 Black Sea Party Zone 7

Prodigy Spirit of Burgas 2012 Black Sea Party Zone 8

The Prodigy – Spirit of Burgas 2012 Black Sea Party Zone 9

Prodigy Spirit of Burgas 2012 Black Sea Party Zone 10

By the way during the concert all around the scene, there was massive marijuana smoke (not to say fog 🙂 ). Probably kilos of “Mara” (as smokers call it for short in BG) was smoken by fans during the 1.15 mins group performance.
As a result, many of the ruffling fans were in a tranced “Nirvana” state 🙂
Something, I’ve noticed is the quality of Prodigy performance, has severely fallen if compared to old concerts of the band period 1999 – 2002.
One moment in the concert was really pissing off for me, when Keith Flinth instructed the public to GET DOWN, saying something like:

Now everybody GET DOWN, I SAID GET DOWN – the sheep fans just followed the ORDER squatting; This was pure “MIND CONTROL” – almost everyone squatted unquestionably.
A girl behind me tried to push me down, to make me kneel down as I refused to squat 🙂
I told her that “I don’t follow orders, jokingly and didn’t squatted 🙂

This squatting from Christian position looked like exactly like worshipping Prodigy as [ idol (God) substitute ] …
The concert end up in a very stupid way; there was no encore performance, not even introduction of the band members to the people and even a no simply BYE to the fans. They just shut off and went away silently like a beaten dogs 🙂

Following the end of Prodigy performance on the neighbor Stage, the “legendary” Bulgarian Punk / Rock old-school band KONTROL was playing. I had great fun with KONTROL as I used to be very much loving the band back in my metal years 🙂 KONTROL’s performance was just great, but unfortunately the scene lightning was again shit and the big Video Screens was switched off so I could see the band hardly. After KONTROL’s end up another hard-core Bulgarian band jumped the scene (PIRANNHA). This guys, were completely funny and i really disliked them as they were heavily copying Venom, even their logo was copied from Venom’s Goat Pentagram (the band mascot was a Satanic Pentagram on wheels (complete iditiosm) :D)
The vocal were cursing themselves, screaming funnily “F*CK PIRANNHA, F*CK PIRANNHA !” 🙂

Spirit of Burgas was supposed to close about 5 in the morning, but I was too busy and I left in 2:45, spending few minutes listening to some kind of nice sounding Drum and Bass DJ playing on the main stage.

Friday Night

Sunday, January 20th, 2008

At Friday I, Zuio and Kiro (Kumcho Vylcho :). Went in the central park with a bottle of wine and 2l of beer. After the alcoholwas depleted Zuio suggested to buy 2 more bottles of wine. And we got very drunk it’s a miracle we are now fine.Yeterday I had a terrible headache. Yesterday I was on a birthday of Andon (Blackstar^) :). Tomorrow I haveexam in HRQM. I haven’t seriously studied yet. So I had to sit on my back and study.END—–

A Sunday in the Netherlands

Monday, September 1st, 2008

I woke up, washed my teeth, did my regular morning excersises then Ina came my room and we went out shopping. In Sunday all shopsare closed in the netherlands thus the near food store we usually shop from Alberheim is closed too. That’s why we moved to the center.We first ate in a place called “Subway”, the vegetarenian sort of hamburger costed 2 EU, then we walked through the shops in the center andresearched where is what and how the prices vary in the different stores. Ina bought sunglasses, a blouse and ear-rings. We were also happyto find 24 hours opened shop right in the center. It seems that usually in Sunday the only place where the shops are opened is the center.We took some beer and went and stood along a little lake enjoying the swan and the ducks and crows which moved and flewer aroud. Then we catched the way for home looking around for unlocked bikes which we may take (it’s common here in the Netherlands to just take unlocked bikes and make them yours even I heard a lot of people leave the old unusused bikes on the street unlocked so you can just take it and use it.On our way home Ina saw left old Zanussi fridge next to a trash bin with a note on it saying something in Dutch containing the Dutch word “wekrt” which literally translated means works. So we hoped the fridge is a working one. We called Koko and Sali to come end help us with the fridge. Then Koko and Sali came and helped us move the fridge to the Honigkamp 2 which is the building of the dormitory I live in. LaterI collected the dry laundry and went to take a shower, then I moved to the 5th floor’s kitchen (My room is in the 1st floor). Wherewe gather with Ina for breakfasts, lunch or dinner. It’s a common thing the last few days that all the Bulgarians that we live in Honigkamp just gather together with the laptops and listen to a different kinds of music and talking about stuff. Although is’s so nice in the Netherlands I’m homesick a little. I also feel like going in no concrete direction. It’s a common thing temptations come that tempt me to smoke again. Also a really terrible temptation I face is a one I faced a dozen of times. You know there are some girls that really are my type of girls unfortunately every time I look at that girls I start falling in love. This is just fine the bad thing is that I’m usually too “different”, unconventional etc. to fit nice with the girls I like. Day by day I search for truths and I’m not sure I’m able to reach them .. the poor man I’m ehh…END—–

My pleasent time back home in Bulgaria

Sunday, January 4th, 2009

I experienced mostly a great time in Bulgaria. Refreshing days went to Kavarna with Nomen to confess my sins in front of a priest. I purposely has selected Kavarna’s Church and father “Vasilii” because I liked him as a priest. I’ve been on a liturgy once during the summer in the church where he takes care for. After the Liturgy I drived Mitko’s Audi A3 towards Dobrich. I’m a new driver so I need to practice. I drived during this days few more times. We went several times for a coffees and pubs with Nomen and Alex. We also went out with Nicki Mitko’s brother a couple of times and we had a great time together coffee-ing. I also went to a dentist. It seems that I had caries and they had to fix my teeth. The caries was in the last stage that it could be so the dentist had to kill and remove my nerve and he did so, the nerve was killed (with arsenic fluid) and removed and the tooth was filled in. I also went out for a drink 3 times with Lily. I went to liturgy 2 times. I met a nice priest (Father Veliko). In Varna when I came back from the Netherlands I met Order and had a great time with him. A lot of other things that I can hardly remember. The Christmas this year. My whole family was there except my grandma who had to be in the hospital (however the Christmas was just perfect!) Thanks to God! I and my family gathered together and had a nice talk and dinner even we said the Lord’s prayer before we started eating it was so nice … The New Year eve was a nice one as well. Even my grandma was there. If we don’t count few minor downfalls like a small quarrel with my sis all went well. I was home with my family until 1.30 in the morning and afterwards went to Denica’s who is a close friend of Nomen, Pavlin was there as well he is an old friend from the metal days of my past. I drinked a couple of glasses of beer and wine. In the morning I had a little hang-over as as a consequence from the drinking. The 13 days I was in Bulgaria has passed so quickly. I shared with my grandma and mother that I feel bad physically, emotionally and mentally. During my stay I also have been aguest in my aunt a couple of times, so nice time there as well.The food in Bulgaria is so great I was very, very happy to eat the delicios food there. The food here in the Netherlands is completely terrible compared to the one at home! In short that was how my days passed there. And I’m so happy about them! I’m looking forward to go home as fast as possible I realize my place is not abroad. When I firstly came here I thoiught that maybe my place is somewhere in some of the developed countries like here in The Netherlands. Now I think differently. It’s quite interesting that after I went out of Bulgaria I became much more a patriot. When I was living there I always has praised the developed countries way of living and thinking. Now it’s a completely different story I sometimes even like the bad things in Bulgaria. I wonder if other people who went out of Bulgaria to work or study has experienced the same.Anyways thanks to the Lord I had a safe journey from Bulgaria to the Netherlands. And here I’m here in the dorm again. I’m gonna tell in short my experiences from the trip back from Bulgaria to the Netherlands in a different post in a minute.END—–

The last two weeks

Saturday, December 16th, 2006

Heya. Few weeks I can’t take the courage to write on the blog. But today I’m spiritually (Praise be to God!). So I was able to write that. The day passed away in a very traditional way. I went to the collage in 10:15 instead of 08:15 again I was not able to stand up from the bed. We had some International Law lectures up to 11:30, after that we drank coffee with Nomen. Smoked few cigarettes. Later on I had a Deutsch 12:30 to 15:45. We made a test the time between 14:15 – 15:45 ( I was not ready for that test ofcourse :] ). No matter price be to God I succeded to write stuff in the test. After that I spoke fo 1.5 h with the College Sys Admin we discussed mine idea to migrate some Windows 98 boxes to just dumb terminals connecting to a central Terminal Server. In monday maybe we’ll start doing the terminal server. Other things I saw Nomen and Habib in 17:10 in the college. Mitko give a promise to Malin to check something on his computer, so we had to go Malin’s home. So we went there nothing special their we put Habib in front of the Malin’s home door and he rang we with mitko hide and watched. Dori (The woman of Malin), went out looking shocked at Habib, she was possible wondering who is that strange (nigga like guy). Habib said: “Malin, Vkyshti” :]. Dori said: “Malin ne vkyshti” then we showed ourself and laughed;] We tried to fix the malin’s problem with the Audio Drivers but was not able the problem seemed to be a hardware one. After that we went to Mino’s coffee we saw Miro and Gosho with Zuio Kiro and Maya. We drinked some beer and went our homes. End of story. The last days were hard for me. I really have no idea where my life is going into nomatter I hope God will think about me a good way the best way. I had a big spiritual pain over the last days, and I said to God a lot of times I hope he will take me away, from this hellish earth. But I guess his plan is another for me. Will live and will see. Now God Even now you see me. Please help me fix the mess I am into and forgive me for all my awful deeds. Will go now. Blessings in the name of Jesus Christ.

Knowing Not! :]

Monday, January 22nd, 2007

Today I have Marketing exam. Ofcourse as usual when I have exams I haven’t studied enough, and again I’m in the situation realizing I don’t know anything. I depend 100% on God’s grace to take that exam. Why I’m so dumb never study when

I have what I have. I can’t change my self I can’t study something I’m not interested into. Marketing is a subject which is simple but for Jerks IMHO :]. The logic of marketing is too abstract.

And yes what’s happening with me the last days. Well I’m feeling good now Praise the Lord. I’ve no idea what I should do with my life. I have 2 re-exams for now or maybe 3 ( I don’t know the results from the Research & Statistics Exam ).

The last few days I ran FreeDOS and Windows 2000 Pro SP4 under FreeBSD 6.2 with qemu. FreeDOS’s performance is very nice despite the fact it is emulated. The Windows is running a little laggish although I ran it with kqemu ( Experimental Module for qemu which enhances the typical qemu speed ). Yesterday we drink a dark beer with Nomen into the “Happy Person” Pub. My passion for computers is starting to come back again.

The Economics Exam. Or the day of a standard man :]

Tuesday, January 30th, 2007

Today. I had exam on marketing. The exam started 50 minutes later because the teachers had some sort of meating.I was able to get most of the test answers from one collegue but I’m not sure are her answers correct.I hope if God give me a help I would pass. After that me and some others from my group tried to get the anwers or the exam for our next exam which is tomorrow and is in the Accounting discipline.Unluckily we were not able to find anything. As usual I don’t know anything and I hope on a miracle and God’smercy to take the exam. I invited Habib to come home to explain me some of the matters. But my mind was toooverheaded with information so I was not in a mood for studying. After that we went out with Habib, Mitko,Toto and Sami. All started well until the Zuio’s father come to our table ( we were drinking beer on the fountain).He come and started kissing all of the guys around he started talking total bullshits to Habib and otherpersons in the coffee terrible picture The Classical “Bai Ganio” in action. After that we walked for some timewith Habib on the way to his home. And drinked a coffee on the “Zhurnalist” Coffee. Now I’m home again.After some problems luckily, I was able to start skype’s microphone to work under my FreeBSD.I have to sit on my back and study for few ours. Thanks God I didn’t have any problems with my Servers.Glory is for the Lord of Hosts.END—–