トップ 追記

Masa's blog

検索キーワード:

2017年11月05日 Fix for `East Asian Ambiguous Character Width(EAW )' [長年日記]

_ How to Fix

Get UTF-8-EAW-FULLWIDTH.gz

# cp UTF-8-EAW-FULLWIDTH.gz /usr/share/i18n/charmaps/
# cd /usr/share/i18n/charmaps/
# localedef -f UTF-8-EAW-FULLWIDTH -i ja_JP ja_JP.UTF-8

_ Undo

# localedef -f UTF-8 -i ja_JP ja_JP.UTF-8

Awesome!


2017年10月27日 powershell server and client [長年日記]

_ psserver.ps1

#
# ex. psserver.ps1 12345 "^192\.168\.0\.[0-9][0-9]*$"
#
#     schtasks /create /s _IP_ /u _DOMAIN_\administrator /p _ADMIN_PASSWORD_ /ru _DOMAIN_\administrator /rp _ADMIN_PASSWORD_ /sc onstart /tn "_TITLE_" /tr "'powershell' '-NoProfile' '-ExecutionPolicy' 'Unrestricted' '-File' 'C:\temp\psserver.ps1' '12345' '^127\.0\.0\.1$|^192\.168\.0\.[0-9][0-9]*$'" /rl HIGHEST /f
#
#------------------------------------------------------------
# Argument
#------------------------------------------------------------
$port = $args[0]
$allowip = $args[1]

#------------------------------------------------------------
# Function
#------------------------------------------------------------
#
# return: line data for success
#         $null for failure
#
Function readLine($rd){
	try {
		$line = $reader.readLine()
	}catch{
		$line = $null
	}
	return $line
}
#
# return: $true for success
#         $false for failure
#
Function writeLine($wd, $line){
	$stat = $true
	try {
		$wd.writeLine($line)
		$wd.Flush()
	}catch{
		$stat = $false
	}
	return $stat
}
#
# return: $true for success
#         $false for failure
#
Function runAndReturnResalt($wd, $cmd){
	$stat = $true
	try {
		Invoke-Expression $cmd |
		Out-String -stream |
		Foreach-Object {
			$res = $_ -replace " *$", ""
			if ((writeLine $wd (":"+ $res)) -eq $false){
				$stat = $false
				break
			}
		}
	}catch{
		$stat = $false
	}
	return $stat
}
#------------------------------------------------------------
# Main procedure
#------------------------------------------------------------
$endpoint = New-Object System.Net.IPEndPoint([System.Net.IPAddress]::Any, $port)
$server = New-Object System.Net.Sockets.TcpListener $endpoint
$server.start()

$shutdown = $false
while (-not $shutdown){
	$client = $server.AcceptTcpClient()
	if ($client.Client.RemoteEndPoint.Address.IPAddressToString -match $allowip){
		$stream = $client.GetStream()
		$reader = New-Object IO.StreamReader($stream,[Text.Encoding]::Default)
		$writer = New-Object IO.StreamWriter($stream,[Text.Encoding]::Default)
		while (($line = readLine $reader) -ne $null -and (-not $shutdown)){
			if ($line -match "^@shutdown$"){
				$shutdown = $true
			}else{
				if ((runAndReturnResalt $writer $line) -ne $true){
					$stat = writeLine $writer ("Failed : " + $line)
				}
			}
			$stat = writeLine $writer "__END__"
		}
		$writer.Close()
		$reader.Close()
		$stream.Close()
		$client.Close()
		$writer = $null
		$reader = $null
		$stream = $null
		$client = $null
	}else{
		$client.Close()
		$client = $null
	}
}

$server.stop()

_ psclient.ps1

#
# ex. psclient.ps1 192.168.0.1 12345 "dir *.txt"
#
#------------------------------------------------------------
# Argument
#------------------------------------------------------------
$addr = $args[0]
$port = $args[1]
$cmd = $args[2]

#------------------------------------------------------------
# Functions
#------------------------------------------------------------
#
# return: line data for success
#         $null for failure
#
Function readLine($rd){
	try {
		$line = $reader.readLine()
	}catch{
		$line = $null
	}
	return $line
}
#
# return: $true for success
#         $false for failure
#
Function writeLine($wd, $line){
	$stat = $true
	try {
		$wd.writeLine($line)
		$wd.Flush()
	}catch{
		$stat = $false
	}
	return $stat
}

#------------------------------------------------------------
# Main procedure
#------------------------------------------------------------
$client = New-Object System.Net.Sockets.TcpClient ($addr, $port)
$stream = $client.GetStream()
$reader = New-Object IO.StreamReader($stream,[Text.Encoding]::Default)
$writer = New-Object IO.StreamWriter($stream,[Text.Encoding]::Default)

$stat = writeLine $writer $cmd
$line = readLine $reader
while ($line -ne $null -and $line -ne "__END__"){
	$line -replace "^:", ""
	$line = readLine $reader
}

$writer.Close()
$reader.Close()
$stream.Close()
$client.Close()

2017年10月20日 Using named pipe with PowerShell [長年日記]

_ `echo' Server

$shutdown = $false
while (-not $shutdown){
        $pipe = New-Object System.IO.Pipes.NamedPipeServerStream "NamedPipeForEcho",InOut
        $pipe.WaitForConnection()
        $buf = New-Object byte[] 1024
        $loop = $true
        while($loop) {
                try {
                        $len = $pipe.Read($buf, 0, $buf.Length)
                        $cmd = [System.Text.Encoding]::Unicode.GetString($buf, 0, $len)
                        if($cmd -match '^exit|^quit|^shutdown') {
                                $loop = $false
                                if($cmd -match '^shutdown') {
                                        $shutdown = $true
                                }
                        } else {
                                $wb = [System.Text.Encoding]::Unicode.GetBytes($cmd)
                                $pipe.Write($wb, 0, $wb.Length)
                        }
                }catch{
                        $loop = $false
                }
        }
        $pipe.Close()
}

_ Client

$pipe = New-Object System.IO.Pipes.NamedPipeClientStream ".", "NamedPipeForEcho",InOut
$pipe.Connect()
$buf = New-Object byte[] 1024

$wb = [System.Text.Encoding]::Unicode.GetBytes("Hello, world.")
$pipe.Write($wb, 0, $wb.Length)
$len = $pipe.Read($buf, 0, $buf.Length)
[System.Text.Encoding]::Unicode.GetString($buf, 0, $len)

$wb = [System.Text.Encoding]::Unicode.GetBytes("exit")
$pipe.Write($wb, 0, $wb.Length)
#$wb = [System.Text.Encoding]::Unicode.GetBytes("shutdown")
#$pipe.Write($wb, 0, $wb.Length)

2017年10月08日 llvm-3.9 or later was required to build firefox-56 on Slackware-14.2 [長年日記]

_ I had to do version up llvm-3.8 to llvm-3.9.1 to build firefox-56.0.1

_ llvm.Slackbuild

_ Build

# sh llvm.SlackBuild

_ Install

# installpkg /tmp/llvm-3.9.1-x86_64-2.txz

And then I got success to build firefox-56 ;)


2017年09月24日 How to read QRCode by using zbar-0.10 on Slackware-14.2 [長年日記]

_ Build of zbar-0.10 on Slackware-14.2

  • ln -s /usr/include/libv4l1-videodev.h /usr/include/linux/videodev.h
  • tar xvf zbar-0.10.tar.bz2
  • cd zbar-0.10
  • ./configure && make && make install
  • rm /usr/include/linux/videodev.h

_ qrcode.sh

#! /bin/sh
LD_PRELOAD=/usr/lib64/libv4l/v4l1compat.so zbarcam /dev/video0 |\
while :
do
	read i
	if [ "X$i" = "X" ]
	then
		break
	else
		isUrl=`echo $i | egrep 'https*://'`
		if [ "X${isUrl}" != "X" ]
		then
			url=`echo $i | sed -e 's/^.*http/http/'`
			echo detected URL is ${url}
			/usr/local/firefox/firefox/firefox ${url}
		else
			echo Ignore $i
		fi
	fi
done

2017年09月21日 Script to merge movies left-right or top-bottom [長年日記]

_ mergemovies.sh

Script to merge two movies into left-right or top-bottom.

#! /bin/sh
#
if [ "X$1" = "X-h" -o "X$1" = "X--help" ]
then
	echo "Usage: $0 -l left_movie -r right_movie -o output_movie [options]"
	echo "       $0 -t top_movie -b bottom_movie -o output_movie [options]"
	echo "Merge movies into output_movie."
        echo ""
	echo "-l LEFT_MOVIE          movie file for left side"
	echo "-r RIGHT_MOVIE         movie file for right side"
	echo "-t TOP_MOVIE           movie file for top side"
	echo "-b BOTTOM_MOVIE        movie file for bottom side"
	echo "-o OUTPUT_MOVIE        movie file for output"
	echo "-a AUDIO_INPUT         lr   for left and right (default)"
	echo "                       l    for left"
	echo "                       r    for right"
	echo "                       tb   for top and bottom (default)"
	echo "                       t    for top"
	echo "                       b    for bottom"
	echo "                       none for no audio"
	echo "-bv VIDEO_BITRATE      bitrate for video (e.g. 2000k)"
	echo "-ba AUDIO_BITRATE      bitrate for audio (e.g. 192k)"
	echo "-vl VOLUME             amplitude for left volume (e.g. 1.2)"
	echo "                       -vr for right"
	echo "                       -vt for top"
	echo "                       -vb for bottom"
	echo "-fr FRAME_RATE         frame rate (e.g. 29.97)"
	echo "-sz SIZE               size for output (e.g. 1920x1080)"
	echo "-stl STARTTIME         start time for left movie (e.g. HH:MM:SS[.mmm])"
	echo "                       -str for right"
	echo "                       -stt for top"
	echo "                       -stb for bottom"
	echo "-etl ENDTIME           endtime for left movie (e.g. HH:MM:SS[.mmm])"
	echo "                       -etr for right"
	echo "                       -ett for top"
	echo "                       -etb for bottom"
	echo "-ell ELAPSTIME         elapstime for left movie (e.g. HH:MM:SS[.mmm])"
	echo "                       -elr for right"
	echo "                       -elt for top"
	echo "                       -elb for bottom"
        exit 0
fi

function preconvert(){
	input=$1; shift
	output=$1; shift
	pw=$1; shift
	ph=$1; shift
	vbitrate=$1; shift
	abitrate=$1; shift
	starttime=$1; shift
	endtime_with_opt=$1; shift
	volume=$1; shift
	framerate=$1

	iwh=`ffmpeg -i ${input} 2>&1 | egrep 'Stream.*Video' | sed -e 's/^.* \([0-9][0-9]*x[0-9][0-9]*\)[^0-9].*$/\1/g'`
	iw=`echo ${iwh} | cut -dx -f1`
	ih=`echo ${iwh} | cut -dx -f2`

	cond=`echo ${iw}*${ph}/${ih}/${pw} | bc`

	if [ ${cond} -gt 0 ]
	then
		sw=${pw}
		sh=`echo ${pw}*${ih}/${iw} | bc`
		padw=0
		padh=`echo "(${ph} - ${sh})/2" | bc`
	else
		sh=${ph}
		sw=`echo ${ph}*${iw}/${ih} | bc`
		padh=0
		padw=`echo "(${pw} - ${sw})/2" | bc`
	fi

	ffmpeg -i ${input} -ss ${starttime} ${endtime_with_opt} -vcodec h264 -b:v ${vbitrate} -r ${framerate} -strict -2 -acodec aac -b:a ${abitrate} -vol ${volume} -filter_complex "[0:v]scale=${sw}:${sh},pad=${pw}:${ph}:${padw}:${padh}" -y ${output}
}

left_movie=""
right_movie=""
top_movie=""
bottom_movie=""
output_movie=""
audio_input=""
video_bitrate="2000k"
audio_bitrate="192k"
left_volume="256"
right_volume="256"
top_volume="256"
bottom_volume="256"
frame_rate="3000/1001"
size="640x360"
left_starttime="00:00:00"
left_endelapstime="-t 24:00:00"
right_starttime="00:00:00"
right_endelapstime="-t 24:00:00"
top_starttime="00:00:00"
top_endelapstime="-t 24:00:00"
bottom_starttime="00:00:00"
bottom_endelapstime="-t 24:00:00"

while [ $# -ne 0 ]
do
	case $1 in
	-l)
		shift
		left_movie="$1"
		;;
	-r)
		shift
		right_movie="$1"
		;;
	-t)
		shift
		top_movie="$1"
		;;
	-b)
		shift
		bottom_movie="$1"
		;;
	-o)
		shift
		output_movie="$1"
		;;
	-a)
		shift
		audio_input="$1"
		;;
	-bv)
		shift
		video_bitrate="$1"
		;;
	-ba)
		shift
		audio_bitrate="$1"
		;;
	-vl)
		shift
		vol=`echo 256 \* $1 | bc | sed -e 's/\..*$//'`
		left_volume="${vol}"
		;;
	-vr)
		shift
		vol=`echo 256 \* $1 | bc | sed -e 's/\..*$//'`
		right_volume="${vol}"
		;;
	-vt)
		shift
		vol=`echo 256 \* $1 | bc | sed -e 's/\..*$//'`
		top_volume="${vol}"
		;;
	-vb)
		shift
		vol=`echo 256 \* $1 | bc | sed -e 's/\..*$//'`
		bottom_volume="${vol}"
		;;
	-fr)
		shift
		frame_rate="$1"
		;;
	-sz)
		shift
		size="$1"
		;;
	-stl)
		shift
		left_starttime="$1"
		;;
	-etl)
		shift
		left_endelapstime="-to $1"
		;;
	-ell)
		shift
		left_endelapstime="-t $1"
		;;
	-str)
		shift
		right_starttime="$1"
		;;
	-etr)
		shift
		right_endelapstime="-to $1"
		;;
	-elr)
		shift
		right_endelapstime="-t $1"
		;;
	-stt)
		shift
		top_starttime="$1"
		;;
	-ett)
		shift
		top_endelapstime="-to $1"
		;;
	-elt)
		shift
		top_endelapstime="-t $1"
		;;
	-stb)
		shift
		bottom_starttime="$1"
		;;
	-etb)
		shift
		bottom_endelapstime="-to $1"
		;;
	-elb)
		shift
		bottom_endelapstime="-t $1"
		;;
	esac
	shift
done

if [ "X${audio_input}" = "X" ]
then
	if [ "X${left_movie}" = "X" ]
	then
		audio_input="tb"
	else
		audio_input="lr"
	fi
fi

pw=`echo ${size} | cut -dx -f1`
ph=`echo ${size} | cut -dx -f2`

if [ "X${left_movie}" = "X" ]
then
	half_ph=`echo ${ph}/2 | bc`
	preconvert ${top_movie} /tmp/mergemovie.$$.1.tmp.mp4 ${pw} ${half_ph} ${video_bitrate} ${audio_bitrate} ${top_starttime} "${top_endelapstime}" ${top_volume} ${frame_rate}
	preconvert ${bottom_movie} /tmp/mergemovie.$$.2.tmp.mp4 ${pw} ${half_ph} ${video_bitrate} ${audio_bitrate} ${bottom_starttime} "${bottom_endelapstime}" ${bottom_volume} ${frame_rate}
else
	half_pw=`echo ${pw}/2 | bc`
	preconvert ${left_movie} /tmp/mergemovie.$$.1.tmp.mp4 ${half_pw} ${ph} ${video_bitrate} ${audio_bitrate} ${left_starttime} "${left_endelapstime}" ${left_volume} ${frame_rate}
	preconvert ${right_movie} /tmp/mergemovie.$$.2.tmp.mp4 ${half_pw} ${ph} ${video_bitrate} ${audio_bitrate} ${right_starttime} "${right_endelapstime}" ${right_volume} ${frame_rate}
fi

ffmpeg -i /tmp/mergemovie.$$.1.tmp.mp4 -strict -2 -acodec copy -vn -y /tmp/mergemovie.$$.3.tmp.wav.mp4
ffmpeg -i /tmp/mergemovie.$$.2.tmp.mp4 -strict -2 -acodec copy -vn -y /tmp/mergemovie.$$.4.tmp.wav.mp4

case ${audio_input} in
lr|tb)
	ffmpeg -i /tmp/mergemovie.$$.3.tmp.wav.mp4 -i /tmp/mergemovie.$$.4.tmp.wav.mp4 -strict -2 -acodec aac -b:a ${audio_bitrate} -filter_complex amix=inputs=2 -y /tmp/mergemovie.$$.5.tmp.wav.mp4
	;;
l|t)
	mv /tmp/mergemovie.$$.3.tmp.wav.mp4 /tmp/mergemovie.$$.5.tmp.wav.mp4
	;;
r|b)
	mv /tmp/mergemovie.$$.4.tmp.wav.mp4 /tmp/mergemovie.$$.5.tmp.wav.mp4
	;;
esac

ffmpeg -i /tmp/mergemovie.$$.1.tmp.mp4 -vcodec copy -strict -2 -an -y /tmp/mergemovie.$$.6.tmp.mp4
ffmpeg -i /tmp/mergemovie.$$.2.tmp.mp4 -vcodec copy -strict -2 -an -y /tmp/mergemovie.$$.7.tmp.mp4
if [ "X${left_movie}" = "X" ]
then
	ffmpeg -i /tmp/mergemovie.$$.6.tmp.mp4 -i /tmp/mergemovie.$$.7.tmp.mp4 -strict -2 -vcodec h264 -b:v ${video_bitrate} -filter_complex "[0:v]pad=iw:ih*2[v1];[v1][1:v]overlay=0:H/2" -y /tmp/mergemovie.$$.8.tmp.mp4
else
	ffmpeg -i /tmp/mergemovie.$$.6.tmp.mp4 -i /tmp/mergemovie.$$.7.tmp.mp4 -strict -2 -vcodec h264 -b:v ${video_bitrate} -filter_complex "[0:v]pad=iw*2:ih[v1];[v1][1:v]overlay=W/2:0" -y /tmp/mergemovie.$$.8.tmp.mp4
fi

if [ "X${audio_input}" = "Xnone" ]
then
	mv /tmp/mergemovie.$$.8.tmp.mp4 ${output_movie}
else
	ffmpeg -i /tmp/mergemovie.$$.8.tmp.mp4 -i /tmp/mergemovie.$$.5.tmp.wav.mp4 -strict -2 -vcodec copy -acodec copy -y ${output_movie}
fi

rm -f /tmp/mergemovie.$$.*.tmp.mp4 /tmp/mergemovie.$$.*.tmp.wav.mp4

2017年09月17日 Script which uses overlay with ffmpeg [長年日記]

_ overlaymovie.sh

Script which uses overlay with ffmpeg.

#! /bin/sh
#
if [ "X$1" = "X-h" -o "X$1" = "X--help" ]
then
	echo "Usage: $0 -m main_movie -s sub_movie -o output_movie [options]"
	echo "put sub_movie on main_movie into output_movie."
        echo ""
	echo "-m MAIN_MOVIE          movie file for background"
	echo "-s SUB_MOVIE           movie file for overlay"
	echo "-o OUTPUT_MOVIE        movie file for output"
	echo "-a AUDIO_INPUT         ms   for main and sub (default)"
	echo "                       m    for main"
	echo "                       s    for sub"
	echo "                       none for no audio"
	echo "-bv VIDEO_BITRATE      bitrate for video (e.g. 2000k)"
	echo "-ba AUDIO_BITRATE      bitrate for audio (e.g. 192k)"
	echo "-vm MAIN_VOLUME        amplitude for main volume (e.g. 1.2)"
	echo "-vs SUB_VOLUME         amplitude for sub volume (e.g. 1.2)"
	echo "-r FRAME_RATE          frame rate (e.g. 29.97)"
	echo "-szm MAIN_SIZE         size for main movie (e.g. 1920x1080)"
	echo "-szs SUB_SIZE          size for sub movie (e.g. 960x540)"
	echo "-stm MAIN_STARTTIME    start time for main movie (e.g. HH:MM:SS[.mmm])"
	echo "-etm MAIN_ENDTIME      endtime for main movie (e.g. HH:MM:SS[.mmm])"
	echo "-elm MAIN_ELAPSTIME    elapstime for main movie (e.g. HH:MM:SS[.mmm])"
	echo "-sts SUB_STARTTIME     start time for sub movie (e.g. HH:MM:SS[.mmm])"
	echo "-ets SUB_ENDTIME       endtime for sub movie (e.g. HH:MM:SS[.mmm])"
	echo "-els SUB_ELAPSTIME     elapstime for sub movie (e.g. HH:MM:SS[.mmm])"
	echo "-p SUB_POSITION        position for sub movie"
        echo "                       t, n   for top"
        echo "                       b, s   for bottom"
        echo "                       r, e   for right"
        echo "                       l, w   for left"
        echo "                       tr, ne for top-right"
        echo "                       tl, nw for top-left"
	echo "                       br, se for bottom-right (default)"
        echo "                       bl, sw for bottom-left"
        echo "                       c      for center"
        exit 0
fi

main_movie=""
sub_movie=""
output_movie=""
audio_input="ms"
video_bitrate="2000k"
audio_bitrate="192k"
main_volume=""
sub_volume=""
frame_rate="3000/1001"
main_size="1920x1080"
sub_size="960x540"
main_starttime="00:00:00"
main_endtime=""
main_elapstime=""
sub_starttime="00:00:00"
sub_endtime=""
sub_elapstime=""
sub_position="br"

while [ $# -ne 0 ]
do
	case $1 in
	-m)
		shift
		main_movie="$1"
		;;
	-s)
		shift
		sub_movie="$1"
		;;
	-o)
		shift
		output_movie="$1"
		;;
	-a)
		shift
		audio_input="$1"
		;;
	-bv)
		shift
		video_bitrate="$1"
		;;
	-ba)
		shift
		audio_bitrate="$1"
		;;
	-vm)
		shift
		vol=`echo 256 \* $1 | bc | sed -e 's/\..*$//'`
		main_volume="-vol ${vol}"
		;;
	-vs)
		shift
		vol=`echo 256 \* $1 | bc | sed -e 's/\..*$//'`
		sub_volume="-vol ${vol}"
		;;
	-r)
		shift
		frame_rate="$1"
		;;
	-szm)
		shift
		main_size="$1"
		;;
	-szs)
		shift
		sub_size="$1"
		;;
	-stm)
		shift
		main_starttime="$1"
		;;
	-etm)
		shift
		main_endtime="-to $1"
		;;
	-elm)
		shift
		main_elapstime="-t $1"
		;;
	-sts)
		shift
		sub_starttime="$1"
		;;
	-ets)
		shift
		sub_endtime="-to $1"
		;;
	-els)
		shift
		sub_elapstime="-t $1"
		;;
	-p)
		shift
		sub_position="$1"
		;;
	esac
	shift
done

main_width=`echo ${main_size} | cut -dx -f1`
main_height=`echo ${main_size} | cut -dx -f2`

sub_width=`echo ${sub_size} | cut -dx -f1`
sub_height=`echo ${sub_size} | cut -dx -f2`

case ${sub_position} in
t|n)
	sub_x=`echo "(${main_width} - ${sub_width}) / 2" | bc`
	sub_y=0
	;;
tr|ne)
	sub_x=`echo "${main_width} - ${sub_width}" | bc`
	sub_y=0
	;;
r|e)
	sub_x=`echo "${main_width} - ${sub_width}" | bc`
	sub_y=`echo "(${main_height} - ${sub_height}) / 2" | bc`
	;;
br|se)
	sub_x=`echo "${main_width} - ${sub_width}" | bc`
	sub_y=`echo "${main_height} - ${sub_height}" | bc`
	;;
b|s)
	sub_x=`echo "(${main_width} - ${sub_width}) / 2" | bc`
	sub_y=`echo "${main_height} - ${sub_height}" | bc`
	;;
bl|sw)
	sub_x=0
	sub_y=`echo "${main_height} - ${sub_height}" | bc`
	;;
l|w)
	sub_x=0
	sub_y=`echo "(${main_height} - ${sub_height}) / 2" | bc`
	;;
tl|nw)
	sub_x=0
	sub_y=0
	;;
c)
	sub_x=`echo "(${main_width} - ${sub_width}) / 2" | bc`
	sub_y=`echo "(${main_height} - ${sub_height}) / 2" | bc`
	;;
*)
	sub_x=`echo "(${main_width} - ${sub_width}) / 2" | bc`
	sub_y=`echo "(${main_height} - ${sub_height}) / 2" | bc`
	;;
esac

ffmpeg -i ${main_movie} -strict -2 -ss ${main_starttime} ${main_endtime} ${main_elapstime} ${main_volume} -vn -y /tmp/overlaymovie.$$.1.tmp.wav.mp4
ffmpeg -i ${sub_movie} -strict -2 -ss ${sub_starttime} ${sub_endtime} ${sub_elapstime} ${sub_volume} -vn -y /tmp/overlaymovie.$$.2.tmp.wav.mp4
case ${audio_input} in
ms)
	ffmpeg -i /tmp/overlaymovie.$$.1.tmp.wav.mp4 -i /tmp/overlaymovie.$$.2.tmp.wav.mp4 -strict -2 -acodec aac -b:a ${audio_bitrate} -filter_complex amix=inputs=2 -y /tmp/overlaymovie.$$.3.tmp.wav.mp4
	;;
m)
	ffmpeg -i /tmp/overlaymovie.$$.1.tmp.wav.mp4 -strict -2 -acodec aac -b:a ${audio_bitrate} -y /tmp/overlaymovie.$$.3.tmp.wav.mp4
	;;
s)
	ffmpeg -i /tmp/overlaymovie.$$.2.tmp.wav.mp4 -strict -2 -acodec aac -b:a ${audio_bitrate} -y /tmp/overlaymovie.$$.3.tmp.wav.mp4
	;;
esac

ffmpeg -i ${main_movie} -strict -2 -ss ${main_starttime} ${main_endtime} ${main_elapstime} -s ${main_size} -an -y /tmp/overlaymovie.$$.4.tmp.mp4
ffmpeg -i ${sub_movie} -strict -2 -ss ${sub_starttime} ${sub_endtime} ${sub_elapstime} -s ${sub_size} -an -y /tmp/overlaymovie.$$.5.tmp.mp4
ffmpeg -i /tmp/overlaymovie.$$.4.tmp.mp4 -i /tmp/overlaymovie.$$.5.tmp.mp4 -strict -2 -vcodec h264 -b:v ${video_bitrate} -r ${frame_rate} -filter_complex "[0:v][1:v]overlay=${sub_x}:${sub_y}" -y /tmp/overlaymovie.$$.6.tmp.mp4

if [ "X${audio_input}" = "Xnone" ]
then
	ffmpeg -i /tmp/overlaymovie.$$.6.tmp.mp4 -strict -2 -vcodec copy -y ${output_movie}
else
	ffmpeg -i /tmp/overlaymovie.$$.6.tmp.mp4 -i /tmp/overlaymovie.$$.3.tmp.wav.mp4 -strict -2 -vcodec copy -acodec copy -y ${output_movie}
fi

rm -f /tmp/overlaymovie.*.*.tmp.*

2017年06月27日 mscore-1.3 on Slackware-14.2 [長年日記]

_ mscore-1.3 on Slackware-14.2

Build

$ tar xvf mscore-1.3.tar.bz2
$ cd mscore-1.3
$ patch ../mscore-1.3.diff | patch -p0
*** ./mscore/mscore/CMakeLists.txt.ORG	2017-06-27 00:14:09.333969024 +0900
--- ./mscore/mscore/CMakeLists.txt	2017-06-27 00:14:41.637968660 +0900
***************
*** 274,279 ****
--- 274,280 ----
        qtsingleapp
        fluid
        z
+       pthread
        )

     if (HAS_AUDIOFILE)
$ make release
$ sudo make install

Setting

Edit -> Setting -> I/O -> check `JACK AUDIO SERVER'


2017年06月20日 How to make WLI-UC-GNM working stably with Slackware-14.2 [長年日記]

_ How to make WLI-UC-GNM working stably with Slackware-14.2

$ lsusb

Bus 004 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 004 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 003 Device 004: ID 056e:0084 Elecom Co., Ltd
Bus 003 Device 003: ID 0411:01a2 BUFFALO INC. (formerly MelCo., Inc.) WLI-UC-GNM Wireless LAN Adapter [Ralink RT8070]    # <- This is WLI-UC-GNM
Bus 003 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

/etc/rc.d/rc.wireless.conf

DC:FB:02:*)
    ESSID="_YOUR_ESSID_"
    MODE="Managed"
    KEY="_YOUR_PASSWORD_"
    IWCONFIG="power off"       # <- This is important!
    ;;

/etc/modprobe.d/rt2800usb.conf

options rt2800usb nohwcrypt=1

2017年06月04日 Version up php-5.5.11 to php-7.1.5 [長年日記]

_ Version up php-5.5.11 to php-7.1.5

Build

$ tar xvf php-7.1.5.tar.bz2
$ cd php-7.1.5
$ cat ../php-7.1.5.diff | patch -p0
*** ./configure.ORG     2017-06-04 10:50:30.000000000 +0900
--- ./configure 2017-06-04 10:55:11.000000000 +0900
***************
*** 79826,79832 ****
  ac_fn_c_check_decl "$LINENO" "isnan" "ac_cv_have_decl_isnan" "#include <math.h>
 "
  if test "x$ac_cv_have_decl_isnan" = xyes; then :
!   ac_have_decl=1
  else
    ac_have_decl=0
  fi
--- 79826,79832 ----
  ac_fn_c_check_decl "$LINENO" "isnan" "ac_cv_have_decl_isnan" "#include <math.h>
 "
  if test "x$ac_cv_have_decl_isnan" = xyes; then :
!   ac_have_decl=0
  else
    ac_have_decl=0
  fi
***************
*** 79837,79843 ****
  ac_fn_c_check_decl "$LINENO" "isinf" "ac_cv_have_decl_isinf" "#include <math.h>
 "
  if test "x$ac_cv_have_decl_isinf" = xyes; then :
!   ac_have_decl=1
  else
    ac_have_decl=0
  fi
--- 79837,79843 ----
  ac_fn_c_check_decl "$LINENO" "isinf" "ac_cv_have_decl_isinf" "#include <math.h>
 "
  if test "x$ac_cv_have_decl_isinf" = xyes; then :
!   ac_have_decl=0
  else
    ac_have_decl=0
  fi
***************
*** 95505,95511 ****
  ac_fn_c_check_decl "$LINENO" "isfinite" "ac_cv_have_decl_isfinite" "#include <math.h>
 "
  if test "x$ac_cv_have_decl_isfinite" = xyes; then :
!   ac_have_decl=1
  else
    ac_have_decl=0
  fi
--- 95505,95511 ----
  ac_fn_c_check_decl "$LINENO" "isfinite" "ac_cv_have_decl_isfinite" "#include <math.h>
 "
  if test "x$ac_cv_have_decl_isfinite" = xyes; then :
!   ac_have_decl=0
  else
    ac_have_decl=0
  fi
***************
*** 95516,95522 ****
  ac_fn_c_check_decl "$LINENO" "isnan" "ac_cv_have_decl_isnan" "#include <math.h>
 "
  if test "x$ac_cv_have_decl_isnan" = xyes; then :
!   ac_have_decl=1
  else
    ac_have_decl=0
  fi
--- 95516,95522 ----
  ac_fn_c_check_decl "$LINENO" "isnan" "ac_cv_have_decl_isnan" "#include <math.h>
 "
  if test "x$ac_cv_have_decl_isnan" = xyes; then :
!   ac_have_decl=0
  else
    ac_have_decl=0
  fi
***************
*** 95527,95533 ****
  ac_fn_c_check_decl "$LINENO" "isinf" "ac_cv_have_decl_isinf" "#include <math.h>
 "
  if test "x$ac_cv_have_decl_isinf" = xyes; then :
!   ac_have_decl=1
  else
    ac_have_decl=0
  fi
--- 95527,95533 ----
  ac_fn_c_check_decl "$LINENO" "isinf" "ac_cv_have_decl_isinf" "#include <math.h>
 "
  if test "x$ac_cv_have_decl_isinf" = xyes; then :
!   ac_have_decl=0
  else
    ac_have_decl=0
  fi
$ ./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysqli=mysqlnd --with-gd --with-zlib --with-bz2 --with-openssl=/usr/local/ssl
$ make
$ su
# make install && ldconfig
# cp php.ini-development /usr/local/lib/php7.ini
# vim /usr/local/lib/php7.ini
# cd /usr/local/lib
# rm php.ini
# ln -s php7.ini php.ini

_ After install php-7, apache got segfault

I have to remove line for old php5.

/usr/local/apache2/conf/httpd.conf

#DEL_LoadModule php5_module        modules/libphp5.so
LoadModule php7_module        modules/libphp7.so