Minor video editing with command line

4 respostas [Última entrada]
Andresm

I am a member!

Desconectado
Joined: 11/21/2010

Hi just a quick post to share what I have discovered and maybe someone might suggest a better way of doing things next time. Or answer some of my questions. I think it will be useful for people wanting to create video tutorials for trisquel

The case scenario:
I had a couple of videos that were recorded as mp4 from a mobilephone these videos showed on my computer screen at an 90 deg angle due to the recording angle. I could just flip the screen to view the videos but I wanted to share the videos. I also wanted to add subtitles to it and be able to make the letters larger so that my grandmother could read it.
I am running trisquel-mini on an 6 year old netbook.
I could not find how to flip the angle openshot or pitivi.
I tried converting to ogv but I messed up the resolution so tips to improve this by using ogv or webm would be best: that way a simple webbrowser could open the files, right?
if you want to use a window and click on to things you can ignore the sudo apt-get install and run the synaptic package manager and look for the programs there and check the several checkboxes and click apply.

The proposed solution:

Following a comment seen on [0]
I installed mediainfo

$sudo apt-get install mediainfo
$ mediainfo FilmOriginal.mp4

I checked frames per second (under the video category) 30.062
I also checked the overall bit rate 895k
I installed avconv (seems that ffmpeg is depreciated for this kind of thing?, don't know).

$ sudo apt-get install avconv
$ avconv -i FilmOriginal.mp4 -r 30.062 -vf transpose=1 -b:v 895k FilmTranspose.mp4

Checked that the video worked. yay!

I used Use gnome subtitle for creating subtitles. I had to make sure to save save as *.srt, utf-8 and unix line breaks. I was having trouble with the ISO bits because my ñ and é í ó ú (spanish characters were not getting there).

$sudo apt-get install gnome-subtitles

under video >load> Filmtranspose.mp4
new file
There is a nifty menu item under edit that will jump to the moment in time you want to add the subtitle.

Then I wanted to add the subtitle, it seems avconv can do that as well, but I was unable to find out how. some -attach options or -scode that I did not manage to put in the right place.
So I used mencoder [1]

$sudo apt-get install mencoder
$ mencoder -sub FilmSubtitles.srt -sub-bg-color 0 -sub-bg-alpha 1 -subfont-text-scale 3.5 -subfont-outline 0 -subfont-blur 0 -subcp UTF-8 -ovc x264 -oac pcm -o filmtransposedandsubtitles.mp4 FilmTranspose.mp4

-subcp is dependant on the language.
-sub subs.srt tells the encoder which subtitle file to use
-sub-bg-color 0 tells the encoder to use black as the font-background color
-sub-bg-alpha 1 tells the encoder to use minimum transparency. 0 will make the font-background totally transparent
-subfont-text-scale 3.5 sets the subtitle font size to a percentage
-oac (audio) and - ovc (video) I am unsure why I cannot copy it directly: probably because it is mp4. I keep getting warnings saying I am not using avi.

And that is all I learnt. it would be great if someone could shed some light as a better way of doing this. But this seemed to work with OK quality.

[0] http://step4wd.com/2013/02/07/rotate-flip-video-files-in-ubuntu-linux/
[1] http://ubuntuforums.org/showthread.php?t=1911473&p=11624421#post11624421

Magic Banana

I am a member!

I am a translator!

Desconectado
Joined: 07/24/2010

About video format conversion, OggConvert is part of Trisquel's default install. This graphical utility is limited and, apparently, not developed anymore (the last version is 3.5 years old). I would suggest Transmageddon as a replacement. It is in Trisquel's repositories. Notice that it can be used to create simple audio files from videos or from other audio files.

Andresm

I am a member!

Desconectado
Joined: 11/21/2010

Thanks Magic Banana!

ogg convert never failed me, but I wanted something that I could scale up or batch script. I do not recall ogg convert having a comand line interface.

I will install transmageddon to see if it can do what I want.

Magic Banana

I am a member!

I am a translator!

Desconectado
Joined: 07/24/2010

Transmageddon is graphical too. So, yes, my answer was off-topic.

onpon4
Desconectado
Joined: 05/30/2012

I've also used WinFF for conversion; it's a frontend for FFmpeg.