Friday, October 30, 2020
Thursday, December 14, 2017
Video Editing with FFMPEG
I had a task in which I had to edit a documentary. As always, I used Blender as my Video Editor e everything was going fine and fast. Until I had to render, that is. A task that usualy takes 1h, max, was taking almost 7hs. And there was a problem in one of the scenes and I had to replace the scene but I had no time to render the whole project again.
So I did a web search on how to cut and concatenate videos with FFMPEG. And guess what, it worked.
First I cut the vídeo, creating 2 files. One with the content before the scene and another with the content after the scene.
ffmpeg -i RetratoFalado-720x480.mkv -ss 00:00:00 -t 00:13:53 -async 1 RetratoFalado-720x480-P1.mkv ffmpeg -i RetratoFalado-720x480.mkv -ss 00:14:09 -t 00:20:00 -async 1 RetratoFalado-720x480-P2.mkv
Then, with the new video file for the scene I concatenated the vídeos
ffmpeg -f concat -safe 0 -i c-mergelist.txt -c copy RetratoFaladoFix.mkv
Where the c-mergelist.txt file is a list of vídeos to be concatenated.
file './RetratoFalado-720x480-P1.mkv' file './RetratoFalado-720x480-chorando.mkv file './RetratoFalado-720x480-P2.mkv'
And, in just a few minutes, I had the documentary fixed.
Sunday, January 22, 2017
Friday, December 2, 2016
FFMPEG - Convert between framerates
Conversion with fixed # of frames
extract the frames as rawvideoffmpeg -i input.mov -f rawvideo -b 50000000 -pix_fmt yuv420p -vcodec rawvideo -s 1920x1080 -y temp.rawrecreate the video with new framerate
ffmpeg -f rawvideo -b 50000000 -pix_fmt yuv420p -r 24 -s 1920x1080 -i temp.raw -y output.mov
Conversion with fixed running length
ffmpeg -i input.mov -sameq -r 24 -y output.mov
Sunday, November 27, 2016
Increase video volume using FFMPEG
To increase the volume of the first audio track for 10dB use:
ffmpeg -i inputfile -vcodec copy -af "volume=10dB" outputfile
Wednesday, September 21, 2016
Reduce PDF size
gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -sOutputFile=output.pdf input.pdf
Monday, January 5, 2015
Thursday, December 18, 2014
Using FFMPEG to generate a video from a sequence of images and an audio file
ffmpeg -i %04d.png -i ../locust.mp3 -c:v libx264 -c:a aac -strict experimental -b:a 192k -shortest out.mp4
Wednesday, July 24, 2013
Blender - Rendering from the command line
Render an Image:
blender -b [directory of file] -o [output] -f [frame number]
Render a Video:
blender -b [directory of file] -o [output] -s [start frame] -e [end frame] -a
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Command_Line
blender -b [directory of file] -o [output] -f [frame number]
Render a Video:
blender -b [directory of file] -o [output] -s [start frame] -e [end frame] -a
http://wiki.blender.org/index.php/Doc:2.6/Manual/Render/Command_Line
Tuesday, July 23, 2013
Creating a video using a sequence of images and FFMPEG
I've been studying Blender for a while now and have developed a preference of saving the animations as a PNG image sequence instead of video files. Later I can load them in Blender's VSE, o kdenlive, and edit the video.
But sometimes I would rather just see how the animation is going without having to load the files again and render them into a video file.
ffmpeg -f image2 -i %04d.png animation.mp4
But sometimes I would rather just see how the animation is going without having to load the files again and render them into a video file.
ffmpeg -f image2 -i %04d.png animation.mp4
Thursday, February 21, 2013
Optimize PNG files with Pngcrush
One of the problems I face often when working with png files on websites is their size. Gimp, Inkscape, Krita, MyPaint, Blender and many other applications are capable of exporting to PNG but the file is usually quite big.
To solve this problem we can use a simple command line program called Pngcrush.
Installation in debian based systems are as simples as running,as a super user or using sudo, the following command on console:
apt-get install pngcrush
To optimize an PNG image file is as simples as
pngcrush -brute -e "Opt.png" filename.png
-brute - Use force brute. It will be time consuming as it will try 114 different filter/compression methods. The image sice reduction factor is significant using thins option.
-e "ext" - Specifi an extension for all output files. In the above example the new file is going to be called filenameOpt.png. This way you are not going to overwrite the original image.
To optimize all files in the a directory you can use:
pngcrush -brute -d "/home/user/path/to/dir/" *.png
To solve this problem we can use a simple command line program called Pngcrush.
Installation in debian based systems are as simples as running,as a super user or using sudo, the following command on console:
apt-get install pngcrush
To optimize an PNG image file is as simples as
pngcrush -brute -e "Opt.png" filename.png
-brute - Use force brute. It will be time consuming as it will try 114 different filter/compression methods. The image sice reduction factor is significant using thins option.
-e "ext" - Specifi an extension for all output files. In the above example the new file is going to be called filenameOpt.png. This way you are not going to overwrite the original image.
To optimize all files in the a directory you can use:
pngcrush -brute -d "/home/user/path/to/dir/" *.png
Wednesday, September 21, 2011
Changing UI font size in Blender
When not actually reading on the computer screen, I like to have the UI as tiny as possible so it won't consume all that precious working space.
On kde and Gnome applications I do that using their respective theme configuration files (eg. ..gtkrc-2.0).
One of the biggest annoyances on Blender, for me, was that the UI, especially text, take up too much space and I was unable to resize it to a more comfortable – read small – size.
Searching the web I found the answer at georgik's blog: Menu → File → User Preferences. In the System tab, which is the one that opens by default, change the DPI value at the General settings.
On kde and Gnome applications I do that using their respective theme configuration files (eg. ..gtkrc-2.0).
One of the biggest annoyances on Blender, for me, was that the UI, especially text, take up too much space and I was unable to resize it to a more comfortable – read small – size.
Searching the web I found the answer at georgik's blog: Menu → File → User Preferences. In the System tab, which is the one that opens by default, change the DPI value at the General settings.
Friday, June 17, 2011
conditional authentication in apache
Just so I can find it later..
AuthType basic
AuthName "Sub Domain authentication"
AuthUserFile /var/www/virtual/.passwd
Require valid-user
Satisfy any
Order deny,allow
Deny from all
Allow from 192.168.100.0/24
Wednesday, May 25, 2011
ssh port forwarding
At home I have dnated port ssh to my trusty old PC. From time to time, while at work, I need to access services I run on that machine. For a while I used to use a OpenVPN vpn to gain access but lately I've had some forewall issues.
So I went back to the good old openssh. To bind port 8080 at my notebook to port 8080 at home I just run the following command:
ssh artista@frustrado.no-ip.org -L 8080:127.0.0.1:8080
So I went back to the good old openssh. To bind port 8080 at my notebook to port 8080 at home I just run the following command:
ssh artista@frustrado.no-ip.org -L 8080:127.0.0.1:8080
Saturday, April 16, 2011
Xorg + Wacom Tablet - configuring dual monitor with tablet working on only one
I must admit: I love my dual display setting, a 2880x900 virtual display composed of 2 19" monitors alamost as much I love sketching with my tablet. If you have seen any recent posts at pincel quebrado (broken brush) you can see how much I've been toying around with my tablets and Gimp and Krita.
But dual display and tablet configurations always had one huge problem: the x-server only uses half of the height of the tablet so it can set the right width. It is a pain to use only half of the tablet so for many years I've disabled dual head and lately created a user for only this purpose that I'd start in another x-session.
Digging through the piles of senseless info available in the web I finally found the solution to the problem, which now seems stupidly obvious: xsetwacom
For setting dual display on my desktop I use:
Which puts my DVI monitor at the right of my VGA monitor. Then use xset wacom to restrict my tablet to my DVI, right, monitor:
But dual display and tablet configurations always had one huge problem: the x-server only uses half of the height of the tablet so it can set the right width. It is a pain to use only half of the tablet so for many years I've disabled dual head and lately created a user for only this purpose that I'd start in another x-session.
Digging through the piles of senseless info available in the web I finally found the solution to the problem, which now seems stupidly obvious: xsetwacom
For setting dual display on my desktop I use:
xrandr --output DVI-0 --right-of VGA-0
Which puts my DVI monitor at the right of my VGA monitor. Then use xset wacom to restrict my tablet to my DVI, right, monitor:
xsetwacom set "Wacom Intuos2 9x12 stylus" "MapToOutput" DVI-0
xsetwacom set "Wacom Intuos2 9x12 eraser" "MapToOutput" DVI-0
xsetwacom set "Wacom Intuos2 9x12 cursor" "MapToOutput" DVI-0
Thursday, March 17, 2011
reset redmine password throught the commmand line
Copied and pasted form http://bitnami.org/forums/forums/redmine/topics/lost-redmine-adminstrator-password
$ cd ${installdir}
$ ./use_redmine
$ cd ${installdir}/apps/redmine
$ ruby script/console production
>> u = User.first
>> u.password = u.password_confirmation = "newpassword"
>> u.save
>> exit
$ cd ${installdir}
$ ./use_redmine
$ cd ${installdir}/apps/redmine
$ ruby script/console production
>> u = User.first
>> u.password = u.password_confirmation = "newpassword"
>> u.save
>> exit
Saturday, October 24, 2009
Compile Scribus from SVN
I've made another script for compiling Scribus desktop publishing app from it's SVN repository.
As all my scripts for compiling stuff, I've published it at my github account.
Do clone the git repository go here. To download the script click here.
As all my scripts for compiling stuff, I've published it at my github account.
Do clone the git repository go here. To download the script click here.
Compile cinepaint from CVS
Cinepaint is a fork of GIMP version 1.0.4 that emerged from the needs of the movie industry which were not being considered by the GIMP developers at the time. It's main purpose is to be a tool for frame-by-frame retouching, dirt removal, wire rig removal, render repair, background plates, and painting 3D model textures .It is widely used in the movie making industry, Hollywood, and has been used by the following companies for their movies:
Since there is no version of Cinepaint packaged for Debian anymore, since it used to rely on GTK 1, I've decided to create another script for compiling it. It is based on Robin Rowe's ubuntu-cvs.sh script
I've published it with my other scripts for compiling Apps at my acount at github.com. To visit the project page at github click here. To download the latest version click here.
- Amalgamated Pixels (Elf, Looney Tunes)
- Computer Cafe (League of Extraordinary Gentlemen)
- Flash Film Works (Duplex, The Last Samurai)
- Hammerhead (Showtime, Blue Crush, 2 Fast, 2 Furious)
- Rhythm & Hues (Harry Potter, Cats & Dogs, Dr. Dolittle 2, Little Nicky, Grinch, Sixth Day, Stuart Little, Planet of the Apes)
- Sony Pictures Imageworks (Stuart Little II, Spider-Man)
Since there is no version of Cinepaint packaged for Debian anymore, since it used to rely on GTK 1, I've decided to create another script for compiling it. It is based on Robin Rowe's ubuntu-cvs.sh script
I've published it with my other scripts for compiling Apps at my acount at github.com. To visit the project page at github click here. To download the latest version click here.
Tuesday, August 4, 2009
Compiling the GIMP from GIT
As the GIMP, as well as all gnome packages, have switched from SVN to GIT I've updated my compiling script to use the GIT sources.
You can download the script form here
Below is the listing of the script
You can download the script form here
Below is the listing of the script
#!/bin/bash
co_compile_install()
{
DIR=$1
PARAMS=$2
COMMAND=$3
echo "Installing $DIR"
# bash check if directory exists
if [ -d $DIR ]; then
echo "Directory exists - UPDATING"
cd $DIR
#svn update
git pull
else
echo "Directory does not exists - CHECKING OUT"
#svn checkout "http://svn.gnome.org/svn/$DIR/trunk" "$DIR"
git clone git://git.gnome.org/$DIR
cd $DIR
fi
if [ -n $COMMAND ]
then
eval $COMMAND
fi
./autogen.sh
pwd
./configure --prefix=/opt/gimp-svn $PARAMS && make && make install
cd ..
}
# GLIB
co_compile_install "glib"
export PATH=/opt/gimp-svn/bin:$PATH
export LD_LIBRARY_PATH=/opt/gimp-svn/lib
export PKG_CONFIG_PATH=/opt/gimp-svn/lib/pkgconfig
# GTK
co_compile_install "gtk+" "--with-xinput=yes --disable-gtk-doc" "sed -r 's#(automake|aclocal)-1.7#\1#g' -i autogen.sh"
#co_compile_install "gtk+" "--with-xinput=yes --disable-gtk-doc"
# BABL
co_compile_install "babl"
# GEGL
co_compile_install "gegl" "" "sed -r 's:#include:#include :g' -i operations/external/ff-load.c"
export PATH=/opt/gimp-svn/bin:$PATH
export LD_LIBRARY_PATH=/opt/gimp-svn/lib
export PKG_CONFIG_PATH=/opt/gimp-svn/lib/pkgconfig
# GIMP
co_compile_install "gimp" "--enable-gimp-remote --prefix=/opt/gimp-svn/ --with-gimpdir=.gimp-svn"
Compiling Sane from GIT
My trusty old scanjet 4c just gave up a few months ago and all I was left with was a crappy Scanjet ScanJet G2710, which has a really basic driver. And basic I mean it can only be trusted to scan BW drawings, not even grayscale gets a decent result.
But that was not the only problem. Even though I use Debian SID (unstable) in all my workstations the sane backends were not detecting my scanner so I've had to compile from the sources. Being lazy, one of the big virtues of a hacker according to Eric Raymond, I've created a bash script to fetch the sources from CVS, compile and install sane.
Now that sane has switched to GIT I've rewrote the script and added a patch to xsane so I would not have to manually declare the SANE_CAP_ALWAYS_SETTABLE constant, which has been removed by sane but is still used by xsane. I seems Oliver Rauch has some problems with the way the sane development is going and is not updating xsane to conform to the changes made to the sane backends.
You can download the script form here
Below is the listing of the script
But that was not the only problem. Even though I use Debian SID (unstable) in all my workstations the sane backends were not detecting my scanner so I've had to compile from the sources. Being lazy, one of the big virtues of a hacker according to Eric Raymond, I've created a bash script to fetch the sources from CVS, compile and install sane.
Now that sane has switched to GIT I've rewrote the script and added a patch to xsane so I would not have to manually declare the SANE_CAP_ALWAYS_SETTABLE constant, which has been removed by sane but is still used by xsane. I seems Oliver Rauch has some problems with the way the sane development is going and is not updating xsane to conform to the changes made to the sane backends.
You can download the script form here
Below is the listing of the script
#!/bin/bash
co_compile_install()
{
DIR=$1
PARAMS=$2
COMMAND=$3
if [ -d $DIR ]; then
echo "Directory exists - UPDATING"
cd $DIR
#svn update
git pull
else
echo "Directory does not exists - CHECKING OUT"
git clone git://git.debian.org/sane/$DIR
cd $DIR
fi
if [ -n $COMMAND ]
then
eval $COMMAND
fi
./autogen.sh
pwd
./configure --sysconfdir=/etc --prefix=/usr && make && make install
cd ..
}
co_compile_install sane-backends.git
co_compile_install sane-frontends.git
wget ftp://ftp.sane-project.org/pub/sane/xsane/xsane-0.996.tar.gz
tar -zxvf xsane-0.996.tar.gz
cd xsane-0.996
rm -f /tmp/xsane-back-gtk.h.diff
cat >> /tmp/xsane-back-gtk.h.diff << EOF
55a56
> #define SANE_CAP_ALWAYS_SETTABLE 7
EOF
patch src/xsane-back-gtk.h /tmp/xsane-back-gtk.h.diff
rm -f /tmp/xsane-back-gtk.h.diff
./configure --sysconfdir=/etc --prefix=/usr && make && make install
Subscribe to:
Posts (Atom)