Category Archives: Linux

Stuff about Linux

Linux: Mount a Windows share with kerberos authentication

Hi,

in some secure environments only kerberos authentication is allowed to connect to a Windows file share.

This example demonstrate the procedure on how to mount a share on a Debian 7 (Wheezy)  Linux. Other distributions should provide a simliar way.

First of all install the necessary pakets.

michael@debdev:~# apt-get install krb5-user krb5-config cifs-utils keyutils

After installing the packages the Kerberos configuration wizard starts.
Continue reading Linux: Mount a Windows share with kerberos authentication

Advertisment to support michlstechblog.info

Linux: Some ffmpeg command line examples

Hi,

here are a list of some command line examples for converting audio and video files with ffmpeg. ffmpeg is part of the most linux distributions but there is also a Windows version available.

Convert ogg to mp3, with -a you can specify some audio options here a bitrate of 192k
ffmpeg -i input.ogg -ab 192k output.mp3
To remove the embedded cover(Cover is saved as Video Stream)

ffmpeg -i input.mp3 -vn -ab 192k output.mp3
To remove cover and copy the audio stream, no remux is done => better quality
ffmpeg -i input.mp3 -y -map 0:a -codec:a copy -map_metadata -1 output.mp3

Covert a MKV container to avi. 2 Steps required.

Step 1 (h264 -> mpeg4)

ffmpeg -i video.mkv -qscale 0 -acodec copy temp.avi

and Step 2

ffmpeg -i temp.avi -vcodec mpeg4 -b 4000k -acodec mp2 -ab 320k output.avi

MPEG4 to xvid Bitrate 1200kb half resolution, AC3 to mp3 128kb
ffmpeg -i temp.avi -vf scale=iw/2:-1 -b 1200k -q:v 2 -q:a 2 -c:v libxvid  -c:a libmp3lame -b:a 128k output.avi
Another simple way to xvid
ffmpeg -i input.avi -c:v mpeg4 -vtag xvid output.avi
MKV to xvid 4:3
ffmpeg -i input.mkv -sn -c:a libmp3lame -ar 48000 -ab 128k -ac 2 -c:v libxvid -crf 24 -vtag DIVX -vf scale=640:480 -aspect 4:3 -mbd rd -flags +mv4+aic -trellis 2 -cmp 2 -subcmp 2 -g 30 -vb 1500k output.avi
MKV to xvid 16:9
ffmpeg -i input.mkv -sn -c:a libmp3lame -ar 48000 -ab 128k -ac 2 -c:v libxvid -crf 24 -vtag DIVX -vf scale=720:480 -aspect 16:9 -mbd rd -flags +mv4+aic -trellis 2 -cmp 2 -subcmp 2 -g 30 -vb 1500k output.avi
Format to play on some DVD Player with SDCard (Medion for example)
ffmpeg -i input.mkv -f avi -c:v libxvid -qscale:v 2 -vf scale=512x280 -c:a libmp3lame -b:a 320k output.avi
and with a limited bitrate
ffmpeg -i input.mkv -f avi -c:v libxvid -b:v 1M -maxrate 1M -bufsize 1M -vf scale=512x280 -c:a libmp3lame -b:a 320k output.avi
Scale to a specific resolution and preserve aspect ration
ffmpeg -i temp.avi -vf scale=320:-1 output_320.avi

Scale to the current resolution divided by 3
ffmpeg -i output.mov -vcodec libx264 -acodec aac -vf scale=iw/3:ih/3 test.mp4

Concat 2 files with the same codec. Create a list of video files and write it to file

cat movlist.txt
file 'movPart1.avi'
file 'movPart2.avi'
ffmpeg -f concat -i movlist.txt -c copy mov.avi

 
Same but with mp3 files, Metadata are used from mp3File1.mp3

ffmpeg -i "concat:mp3File1.mp3|mp3File2.mp3" -acodec copy mp3file.mp3

Export Metadata from an mp3 file

ffmpeg -i mp3File1.mp3 -f ffmetadata mp3File1.metadata

With new metadata

ffmpeg -i "concat:mp3File1.mp3|mp3File2.mp3" -metadata "title=My Heavy Song" -metadata "artist=Metalartist" -metadata "album=Best Metal Album ever" -acodec copy mp3file.mp3 -vn

To flip a video vertically

ffmpeg -i in.avi -vf vflip flipped.avi

To flip a video horizontally

ffmpeg -i in.avi -vf hflip flipped.avi

Rotate 90° clockwise

ffmpeg -i in.avi -vf transpose=1 flipped.avi

Rotate 90° counterclockwise

ffmpeg -i in.avi -vf transpose=2 -c:a flipped.avi

 
Transpose does a reencoding of the whole video. This simply rotates the video

ffmpeg -i christmas.mov  -metadata:s:v rotate="90" -codec copy output.mov

To map the german audio channel as default. List channels

ffmpeg -i in.avi 2>&1 |grep Stream
    Stream #0:0(eng): Video: h264 (High), yuv420p(tv, bt709/unknown/unknown, progressive)1k tbn, 47.95 tbc (default)..
    Stream #0:1(ger): Audio: ac3, 48000 Hz, stereo, fltp, 224 kb/s (default) (forced)
    Stream #0:2(eng): Audio: ac3, 48000 Hz, 5.1(side), fltp, 640 kb/s

To select the german Audio stream as default use -map 0:a:0, means 1st Audio stream (counted from 0)

ffmpeg -i in.avi ... -map 0:v:0 -map 0:a:0 ...

To be continued

Michael

VMware ESXi: Setting up NAT with a linux virtual machine

Hi,

other than the Workstation, VMware ESXi does not has the functionality to “NATting” virtual machines network traffic into a public network.

My approach to implement NAT is a virtual machine with a slimmed-down (Debian) Linux.

These virtual machine has two network interfaces. The first interface is connected to a vSwitch called “Public LAN” with access to the public LAN, the second interface is connected to a vSwitch which has no physical adapter attached to and is called “NAT Network”. On the NAT interface a DHCP server is assigning IP Addresses.
Continue reading VMware ESXi: Setting up NAT with a linux virtual machine

Linux: Kerberos authentification against Windows Active Directory

Hi,

here are some steps to use kerberos authentification against a active directory with OS Version Windows Server 2008 R2 or later on your linux machine.

The default krb5 configuration implementation of the most linux distributions did not work out of the box. I assume that the REALM in /etc/krb5.conf is already configured.

Typical error messages are:

kinit: KDC has no support for encryption type while getting initial credentials
kinit: KDC reply did not match expectations while getting initial credentials

michael@debdev:~# kinit  michael@subdomain.domain.local
Password for michael@subdomain.domain.local:
kinit: KDC has no support for encryption type while getting initial credentials

To eliminate the “KDC has no support for encryption type while getting initial credentials” issue change the default encryption type in the libdefaults section of the /etc/krb5.conf file.
Continue reading Linux: Kerberos authentification against Windows Active Directory

Raspberry PI: Connecting a HD44780 Display over I2C Bus

Hi everybody,

some application, i.e. XBMC can show informations on a display by using LCDproc as driver.

This post describes a way to connect a HD44780 display to a Raspberry PI  by i2c bus.

Let’s start with the physical layer. This is the overview schematic on how to connect the display to a Raspberry PI.

Connecting a hd44780 Display with Raspberry PI
Connecting a hd44780 Display with Raspberry PI

Based on these I developed small board with a 6 Pin header which is Pin compatible to the Raspberry PI. So a simple 6 pole ribbon cable can be used to connect the HD44780 Display to the fruit.
Here is my PCB. First the schematic.

Board schematic
Board schematic

and my board layout. Unfortunately there are a lot HD44780 models available and the location and the direction of the pins are different, so you have to adapt the layout to the specification of your display.
Continue reading Raspberry PI: Connecting a HD44780 Display over I2C Bus