2012年07月06日 cacaview for w3m [長年日記]
_ cacaview for w3m
cacaview.sh
#! /bin/sh
file=`file $1`
if [ "X`echo ${file}|egrep ' GIF '`" != "X" ]
then
cat $1 |\
giftopnm |\
ppmtobmp >/tmp/cacaview.sh.$$.tmp
elif [ "X`echo ${file}|egrep ' JPEG '`" != "X" ]
then
cat $1 |\
jpegtopnm |\
ppmtobmp >/tmp/cacaview.sh.$$.tmp
elif [ "X`echo ${file}|egrep ' PNG '`" != "X" ]
then
cat $1 |\
pngtopnm |\
ppmtobmp >/tmp/cacaview.sh.$$.tmp
fi
cacaview /tmp/cacaview.sh.$$.tmp
rm -f /tmp/cacaview.sh.$$.tmp
You may think that I had better to use convert to change some image format to BMP, but BMP file which is created by convert is not recognized by cacaview :(
I'm not sure why...
~/.w3m/mailcap
image/*; cacaview.sh %s ;needsterminal
type "I" to see image on link.
2012年07月08日 libcaca require imlib2 [長年日記]
_ libcaca require imlib2
If imlib2 is not in system, cacaview can not load any image except BMP. I built imlib2-1.4.5 first and next I re-built libcaca-1.9.15.beta18, and then I could make cacaview to work fine!
2012年07月20日 Build of minidlna in Slackware-13.37 [長年日記]
_ minidlna-1.1.0(cvs version)
- cvs -d:pserver:anonymous@minidlna.cvs.sourceforge.net:/cvsroot/minidlna login
- cvs -z3 -d:pserver:anonymous@minidlna.cvs.sourceforge.net:/cvsroot/minidlna co -P minidlna
- cd minidlna
- ./autogen.sh
- LIBS="-lavformat -lavcodec -lavutil -lm -lz -lbz2 -lpthread -ldl" ./configure
- make
- make install
minidlna-1.1.0 is easier to build than minidlna-1.0.24, but still don't have a function of transcode. So next minidlna-1.0.24 may be better to use :)
_ minidlna_1.0.24 with transcode patch
I had to do DIRTY HACK to build minidlna-1.0.24 B)
- tar xvzf minidlna_1.0.24_src.tar.gz
- cd minidlna-1.0.24
- tar xOvzf ../minidlna_transcode_1.0.24-5.tar.gz minidlna_1.0.24_transcode.patch | patch -p1
- patch -p1 <minidlna-1.0.24-dirtyhack.diff
#
# minidlna-1.0.24-dirtyhack.diff
#
diff -crN minidlna-1.0.24.ORG/Makefile minidlna-1.0.24/Makefile
*** minidlna-1.0.24.ORG/Makefile 2012-07-21 19:27:34.010000085 +0900
--- minidlna-1.0.24/Makefile 2012-07-21 19:28:11.943000085 +0900
***************
*** 24,29 ****
--- 24,30 ----
#CFLAGS = -Wall -g -Os -D_GNU_SOURCE
CFLAGS = -Wall -g -O3 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 \
-I/usr/include/ffmpeg \
+ -I/usr/local/include/libavutil -I/usr/local/include/libavcodec -I/usr/local/include/libavformat \
-I/usr/include/libavutil -I/usr/include/libavcodec -I/usr/include/libavformat \
-I/usr/include/ffmpeg/libavutil -I/usr/include/ffmpeg/libavcodec -I/usr/include/ffmpeg/libavformat
#STATIC_LINKING: CFLAGS += -DSTATIC
***************
*** 59,65 ****
ALLOBJS = $(BASEOBJS) $(LNXOBJS)
ifeq (,$(findstring CYGWIN,$(OS_NAME)))
! LIBS = -lpthread -lexif -ljpeg -lsqlite3 -lavformat -lavutil -lavcodec -lid3tag -lFLAC -logg -lvorbis
#STATIC_LINKING: LIBS = -lvorbis -logg -lm -lsqlite3 -lpthread -lexif -ljpeg -lFLAC -lm -lid3tag -lz -lavformat -lavutil -lavcodec -lm
else
LIBS = -lpthread -lexif -ljpeg -lsqlite3 -lavformat -lid3tag -lFLAC -lvorbis
--- 60,66 ----
ALLOBJS = $(BASEOBJS) $(LNXOBJS)
ifeq (,$(findstring CYGWIN,$(OS_NAME)))
! LIBS = -lpthread -lexif -ljpeg -lsqlite3 -lavformat -lavutil -lavcodec -lid3tag -lFLAC -logg -lvorbis -ldl -lbz2 -lavutil
#STATIC_LINKING: LIBS = -lvorbis -logg -lm -lsqlite3 -lpthread -lexif -ljpeg -lFLAC -lm -lid3tag -lz -lavformat -lavutil -lavcodec -lm
else
LIBS = -lpthread -lexif -ljpeg -lsqlite3 -lavformat -lid3tag -lFLAC -lvorbis
***************
*** 103,109 ****
$(INSTALL) --mode=0644 minidlna.conf $(ETCINSTALLDIR)
ifeq (,$(findstring CYGWIN,$(OS_NAME)))
! minidlna: $(BASEOBJS) $(LNXOBJS) $(LIBS)
else
minidlna: $(BASEOBJS) $(LNXOBJS)
endif
--- 104,110 ----
$(INSTALL) --mode=0644 minidlna.conf $(ETCINSTALLDIR)
ifeq (,$(findstring CYGWIN,$(OS_NAME)))
! minidlna: $(BASEOBJS) $(LNXOBJS)
else
minidlna: $(BASEOBJS) $(LNXOBJS)
endif
diff -crN minidlna-1.0.24.ORG/albumart.c minidlna-1.0.24/albumart.c
*** minidlna-1.0.24.ORG/albumart.c 2012-02-11 08:37:22.000000000 +0900
--- minidlna-1.0.24/albumart.c 2012-07-21 19:28:11.944000085 +0900
***************
*** 20,25 ****
--- 20,26 ----
#include <string.h>
#include <unistd.h>
#include <dirent.h>
+ #include "dirtyhack.h"
#include <sys/stat.h>
#include <sys/param.h>
#include <libgen.h>
diff -crN minidlna-1.0.24.ORG/daemonize.c minidlna-1.0.24/daemonize.c
*** minidlna-1.0.24.ORG/daemonize.c 2012-07-21 19:27:34.011000085 +0900
--- minidlna-1.0.24/daemonize.c 2012-07-21 19:33:12.132000117 +0900
***************
*** 27,32 ****
--- 27,33 ----
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/types.h>
+ #include "dirtyhack.h"
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
diff -crN minidlna-1.0.24.ORG/dirtyhack.h minidlna-1.0.24/dirtyhack.h
*** minidlna-1.0.24.ORG/dirtyhack.h 1970-01-01 09:00:00.000000000 +0900
--- minidlna-1.0.24/dirtyhack.h 2012-07-21 19:39:44.947000091 +0900
***************
*** 0 ****
--- 1,34 ----
+ typedef __time_t time_t;
+ struct timespec
+ {
+ __time_t tv_sec; /* Seconds. */
+ long int tv_nsec; /* Nanoseconds. */
+ };
+ #define AVMEDIA_TYPE_AUDIO CODEC_TYPE_AUDIO
+ #define AVMEDIA_TYPE_VIDEO CODEC_TYPE_VIDEO
+ #define AV_PKT_FLAG_KEY PKT_FLAG_KEY
+ struct tm
+ {
+ int tm_sec; /* Seconds. [0-60] (1 leap second) */
+ int tm_min; /* Minutes. [0-59] */
+ int tm_hour; /* Hours. [0-23] */
+ int tm_mday; /* Day. [1-31] */
+ int tm_mon; /* Month. [0-11] */
+ int tm_year; /* Year - 1900. */
+ int tm_wday; /* Day of week. [0-6] */
+ int tm_yday; /* Days in year.[0-365] */
+ int tm_isdst; /* DST. [-1/0/1]*/
+
+ #ifdef __USE_BSD
+ long int tm_gmtoff; /* Seconds east of UTC. */
+ __const char *tm_zone; /* Timezone abbreviation. */
+ #else
+ long int __tm_gmtoff; /* Seconds east of UTC. */
+ __const char *__tm_zone; /* Timezone abbreviation. */
+ #endif
+ };
+ #define AVMetadataTag AVDictionaryEntry
+ #define AV_METADATA_IGNORE_SUFFIX AV_DICT_IGNORE_SUFFIX
+ #define av_metadata_get av_dict_get
+ #define CLOCK_MONOTONIC 1
+ #define CLOCK_REALTIME 0
diff -crN minidlna-1.0.24.ORG/inotify.c minidlna-1.0.24/inotify.c
*** minidlna-1.0.24.ORG/inotify.c 2012-07-21 19:27:34.020000085 +0900
--- minidlna-1.0.24/inotify.c 2012-07-21 19:28:11.952000085 +0900
***************
*** 25,30 ****
--- 25,31 ----
#include <libgen.h>
#include <errno.h>
#include <sys/types.h>
+ #include "dirtyhack.h"
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/resource.h>
diff -crN minidlna-1.0.24.ORG/log.c minidlna-1.0.24/log.c
*** minidlna-1.0.24.ORG/log.c 2012-02-15 03:26:53.000000000 +0900
--- minidlna-1.0.24/log.c 2012-07-21 19:28:11.953000085 +0900
***************
*** 22,27 ****
--- 22,28 ----
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
+ #include "dirtyhack.h"
#include <time.h>
#include "log.h"
diff -crN minidlna-1.0.24.ORG/metadata.c minidlna-1.0.24/metadata.c
*** minidlna-1.0.24.ORG/metadata.c 2012-07-21 19:27:34.028000085 +0900
--- minidlna-1.0.24/metadata.c 2012-07-21 19:28:11.956000085 +0900
***************
*** 19,24 ****
--- 19,25 ----
#include <ctype.h>
#include <string.h>
#include <stdlib.h>
+ #include "dirtyhack.h"
#include <sys/stat.h>
#include <unistd.h>
diff -crN minidlna-1.0.24.ORG/minidlna.c minidlna-1.0.24/minidlna.c
*** minidlna-1.0.24.ORG/minidlna.c 2012-07-21 19:27:34.035000085 +0900
--- minidlna-1.0.24/minidlna.c 2012-07-21 19:29:08.188000085 +0900
***************
*** 55,60 ****
--- 55,61 ----
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
+ #include "dirtyhack.h"
#include <fcntl.h>
#include <sys/file.h>
#include <sys/time.h>
diff -crN minidlna-1.0.24.ORG/minissdp.c minidlna-1.0.24/minissdp.c
*** minidlna-1.0.24.ORG/minissdp.c 2012-02-15 03:26:53.000000000 +0900
--- minidlna-1.0.24/minissdp.c 2012-07-21 19:35:08.004000087 +0900
***************
*** 39,44 ****
--- 39,45 ----
#include <netinet/in.h>
#include <arpa/inet.h>
#include <errno.h>
+ #include "dirtyhack.h"
#include "config.h"
#include "upnpdescstrings.h"
diff -crN minidlna-1.0.24.ORG/options.c minidlna-1.0.24/options.c
*** minidlna-1.0.24.ORG/options.c 2012-07-21 19:27:34.037000085 +0900
--- minidlna-1.0.24/options.c 2012-07-21 19:34:41.570000288 +0900
***************
*** 31,36 ****
--- 31,37 ----
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
+ #include "dirtyhack.h"
#include "options.h"
#include "upnpglobalvars.h"
diff -crN minidlna-1.0.24.ORG/playlist.c minidlna-1.0.24/playlist.c
*** minidlna-1.0.24.ORG/playlist.c 2012-02-11 08:37:22.000000000 +0900
--- minidlna-1.0.24/playlist.c 2012-07-21 19:28:11.959000085 +0900
***************
*** 18,23 ****
--- 18,24 ----
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
+ #include "dirtyhack.h"
#include <sys/stat.h>
#include <libgen.h>
#include <limits.h>
diff -crN minidlna-1.0.24.ORG/scanner.c minidlna-1.0.24/scanner.c
*** minidlna-1.0.24.ORG/scanner.c 2012-01-22 09:28:03.000000000 +0900
--- minidlna-1.0.24/scanner.c 2012-07-21 19:28:11.962000085 +0900
***************
*** 23,28 ****
--- 23,29 ----
#include <locale.h>
#include <libgen.h>
#include <inttypes.h>
+ #include "dirtyhack.h"
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/resource.h>
diff -crN minidlna-1.0.24.ORG/sql.c minidlna-1.0.24/sql.c
*** minidlna-1.0.24.ORG/sql.c 2012-02-15 03:44:56.000000000 +0900
--- minidlna-1.0.24/sql.c 2012-07-21 19:41:50.384000068 +0900
***************
*** 18,23 ****
--- 18,24 ----
#include <stdio.h>
#include <string.h>
#include <unistd.h>
+ #include "dirtyhack.h"
#include "sql.h"
#include "upnpglobalvars.h"
diff -crN minidlna-1.0.24.ORG/tagutils/tagutils.c minidlna-1.0.24/tagutils/tagutils.c
*** minidlna-1.0.24.ORG/tagutils/tagutils.c 2010-11-12 08:48:14.000000000 +0900
--- minidlna-1.0.24/tagutils/tagutils.c 2012-07-21 19:28:11.966000085 +0900
***************
*** 27,32 ****
--- 27,33 ----
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
+ #include "../dirtyhack.h"
#include <fcntl.h>
#include <unistd.h>
#include <time.h>
diff -crN minidlna-1.0.24.ORG/upnpdescgen.c minidlna-1.0.24/upnpdescgen.c
*** minidlna-1.0.24.ORG/upnpdescgen.c 2012-01-21 09:34:13.000000000 +0900
--- minidlna-1.0.24/upnpdescgen.c 2012-07-21 19:32:07.045000104 +0900
***************
*** 29,34 ****
--- 29,35 ----
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+ #include "dirtyhack.h"
#include "config.h"
#include "getifaddr.h"
diff -crN minidlna-1.0.24.ORG/upnpevents.c minidlna-1.0.24/upnpevents.c
*** minidlna-1.0.24.ORG/upnpevents.c 2012-02-14 07:48:56.000000000 +0900
--- minidlna-1.0.24/upnpevents.c 2012-07-21 19:41:01.487000033 +0900
***************
*** 57,62 ****
--- 57,63 ----
#include <sys/param.h>
#include <netinet/in.h>
#include <arpa/inet.h>
+ #include "dirtyhack.h"
#include <fcntl.h>
#include <errno.h>
diff -crN minidlna-1.0.24.ORG/upnpglobalvars.c minidlna-1.0.24/upnpglobalvars.c
*** minidlna-1.0.24.ORG/upnpglobalvars.c 2012-07-21 19:27:34.039000085 +0900
--- minidlna-1.0.24/upnpglobalvars.c 2012-07-21 19:34:13.688999997 +0900
***************
*** 53,58 ****
--- 53,59 ----
#else
#include <limits.h>
#endif // __CYGWIN__
+ #include "dirtyhack.h"
#include "config.h"
#include "upnpglobalvars.h"
diff -crN minidlna-1.0.24.ORG/upnphttp.c minidlna-1.0.24/upnphttp.c
*** minidlna-1.0.24.ORG/upnphttp.c 2012-07-21 19:27:34.048000085 +0900
--- minidlna-1.0.24/upnphttp.c 2012-07-21 19:30:12.005000081 +0900
***************
*** 55,60 ****
--- 55,61 ----
#include <sys/param.h>
#include <ctype.h>
#include <sys/types.h>
+ #include "dirtyhack.h"
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
diff -crN minidlna-1.0.24.ORG/upnpsoap.c minidlna-1.0.24/upnpsoap.c
*** minidlna-1.0.24.ORG/upnpsoap.c 2012-07-21 19:27:34.059000085 +0900
--- minidlna-1.0.24/upnpsoap.c 2012-07-21 19:32:38.711999967 +0900
***************
*** 52,57 ****
--- 52,58 ----
#include <sys/socket.h>
#include <unistd.h>
#include <dirent.h>
+ #include "dirtyhack.h"
#include <sys/stat.h>
#include <sys/types.h>
#include <arpa/inet.h>
diff -crN minidlna-1.0.24.ORG/utils.c minidlna-1.0.24/utils.c
*** minidlna-1.0.24.ORG/utils.c 2012-07-21 19:27:34.060000085 +0900
--- minidlna-1.0.24/utils.c 2012-07-21 19:43:05.541000085 +0900
***************
*** 24,29 ****
--- 24,30 ----
#else
#include <limits.h>
#endif // __CYGWIN__
+ #include "dirtyhack.h"
#include <sys/stat.h>
#include <unistd.h>
#include <sys/types.h>
diff -crN minidlna-1.0.24.ORG/uuid.c minidlna-1.0.24/uuid.c
*** minidlna-1.0.24.ORG/uuid.c 2012-07-21 19:27:34.068000085 +0900
--- minidlna-1.0.24/uuid.c 2012-07-21 19:35:38.580000160 +0900
***************
*** 26,31 ****
--- 26,32 ----
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
+ #include "dirtyhack.h"
#include <fcntl.h>
#include <unistd.h>
#include "config.h"
- make
- make install install-conf
2012年07月31日 Encoding script for Panasonic Viera with miniDLNA [長年日記]
_ This is a encoding script that make miniDLNA can provide movie files for Panasonic Viera as DLNA client.
_ convert2dlna_mpegts.sh
This script convert any movie into mpegts(H.264, AC-3).
#! /bin/sh
#
if [ "X$1" = "X-h" -o "X$1" = "X--help" ]
then
echo "Usage : $0 -ix input_x_resolution -iy input_y_resolution [-2] [-s start_time] [ -e elaps_time] [-iax input_aspect_x] [-iay input_aspect_y] [-oax output_aspect_x] [-oay output_aspect_y] [-ab audio_bitrate] [-vb video_bitrate] [-fps frame_per_second] [-o output] inputs [-h|--help] "
echo ""
echo " -ix input_x_resolution : input x resolution"
echo " -iy input_y_resolution : input y resolution"
echo " -2 : 2-pass encoding(default none)"
echo " -s start_time : start position time"
echo " -e elaps_time : elaps(pass) time"
echo " -iax input_aspect_x : input x aspect (default ix)"
echo " -iay input_aspect_y : input y aspect (default iy)"
echo " -oax output_aspect_x : output x aspect (default 16)"
echo " -oay output_aspect_y : output y aspect (default 9)"
echo " -ab audio_bitrate : audio bitrate(Kbps) (default 600)"
echo " -vb video_bitrate : video bitrate(Kbps) (default 128)"
echo " -fps frame_per_second : frame per second (default 30000/1001)"
echo " -o output : output file (default convert2dlna.m2t)"
echo " inputs : input file names separated by space"
exit 0
fi
#
ix=""; export ix
iy=""; export iy
pass="1"
start=""
elaps=""
iax=""; export iax
iay=""; export iay
oax=16; export oax
oay=9; export oay
ab=128
vb=600
fps="30000/1001"
output="convert2dlna.m2t"
#
while [ $# != 0 ]
do
case $1 in
-ix )
shift
ix="$1"
;;
-iy )
shift
iy="$1"
;;
-2 )
pass="2"
;;
-s )
shift
start="-ss $1"
;;
-e )
shift
elaps="-endpos $1"
;;
-iax )
shift
iax="$1"
;;
-iay )
shift
iay="$1"
;;
-oax )
shift
oax="$1"
;;
-oay )
shift
oay="$1"
;;
-ab )
shift
ab="$1"
;;
-vb )
shift
vb="$1"
;;
-fps )
shift
fps="$1"
;;
-o )
shift
output="$1"
;;
* )
input="${input} $1"
;;
esac
shift
done
#
if [ "X${ix}" = "X" ]
then
echo "-ix(input x resolution) is not specified."
exit 1
fi
#
if [ "X${iy}" = "X" ]
then
echo "-iy(input y resolution) is not specified."
exit 1
fi
#
if [ "X${iax}" = "X" ]
then
iax=${ix}
fi
#
if [ "X${iay}" = "X" ]
then
iay=${iy}
fi
#
sx_sy_ex_ey=`cat /dev/null |\
awk 'BEGIN{
ix = ENVIRON["ix"];
iy = ENVIRON["iy"];
iax = ENVIRON["iax"];
iay = ENVIRON["iay"];
oax = ENVIRON["oax"];
oay = ENVIRON["oay"];
if ((ix / iy) == (iax / iay)){
ilx = ix;
ily = iy;
}else if ((ix / iy) < (iax / iay)){
ily = iy;
ilx = iy * iax / iay;
}else{
ilx = ix;
ily = ix * iay / iax;
}
scalex = ilx;
scaley = ily;
if ((ilx / ily) == (oax / oay)){
expandx = ilx;
expandy = ily;
}else if ((ilx / ily) < (oax / oay)){
expandy = ily;
expandx = ily * oax / oay;
}else{
expandx = ilx;
expandy = ilx * oay / oax;
}
printf("%d %d %d %d\n", scalex, scaley, expandx, expandy);
}'`
#
sx=`echo ${sx_sy_ex_ey}|cut -d ' ' -f1`
sy=`echo ${sx_sy_ex_ey}|cut -d ' ' -f2`
ex=`echo ${sx_sy_ex_ey}|cut -d ' ' -f3`
ey=`echo ${sx_sy_ex_ey}|cut -d ' ' -f4`
#
function menc() {
pass=$1
filename=$2
if [ "X${pass}" = "X0" ]
then
vp=""
else
vp="pass=${pass}:"
fi
mencoder \
${start} ${elaps} \
-of lavf -lavfopts format=mpegts \
-ofps ${fps} \
-oac lavc -lavcopts acodec=ac3:abitrate=${ab}:aspect=${oax}/${oay} \
-ovc x264 -x264encopts ${vp}bitrate=${vb} \
-vf scale=${sx}:${sy},expand=${ex}:${ey},harddup \
-o ${filename} \
${input}
}
#
if [ "X${pass}" = "X1" ]
then
menc 0 ${output}
else
menc 1 /dev/null
menc 2 ${output}
fi
_ ffmpeg-1.1.1
I built ffmpeg-1.1.1 with following configuration.
./configure --enable-shared \ --enable-libopencore-amrnb --enable-version3 \ --enable-libopencore-amrwb \ --enable-libmp3lame \ --enable-libfaac --enable-nonfree \ --enable-libx264 --enable-gpl
_ convert2dlna_mp4.sh
This script convert any movie into mp4(H.264, AAC).
#! /bin/sh
#
if [ "X$1" = "X-h" -o "X$1" = "X--help" ]
then
echo "Usage : $0 [-2] [-s start_time] [ -e elaps_time] [-sz size] [-a AX:AY] [-ab audio_bitrate] [-vb video_bitrate] [-fps frame_per_second] [-o output] inputs [-h|--help] "
echo ""
echo " -2 : 2-pass encoding(default none)"
echo " -s start_time : start position time = hh:mm:ss(default none)"
echo " -e elaps_time : elaps(pass) time second(default none)"
echo " -sz size : size for output = XSIZExYSIZE(default same as input)"
echo " -a aspect : aspect ratio for output = X:Y(default same as input)"
echo " -ab audio_bitrate : audio bitrate(Kbps) (default 128)"
echo " -vb video_bitrate : video bitrate(Kbps) (default 600)"
echo " -fps frame_per_second : frame per second (default 30000/1001)"
echo " -o output : output file (default convert2dlna.mp4)"
echo " input : input file name"
exit 0
fi
#
pass="1"
start=""
elaps=""
size=""
aspect=""
ab=128
vb=600
fps="30000/1001"
output="convert2dlna.mp4"
#
while [ $# != 0 ]
do
case $1 in
-2 )
pass="2"
;;
-s )
shift
start="-ss $1"
;;
-e )
shift
elaps="-t $1"
;;
-sz )
shift
size="-s $1"
;;
-a )
shift
aspect="-aspect $1"
;;
-ab )
shift
ab="$1"
;;
-vb )
shift
vb="$1"
;;
-fps )
shift
fps="$1"
;;
-o )
shift
output="$1"
;;
* )
input="$1"
;;
esac
shift
done
#
function menc() {
pass=$1
filename=$2
if [ "X${pass}" = "X0" ]
then
vp=""
else
vp="-pass ${pass}"
fi
ffmpeg \
-y \
${start} ${elaps} \
-i ${input} \
-f mp4 \
-vcodec h264 -b ${vb}k ${aspect} ${size} ${vp} \
-acodec aac -ab ${ab}k -strict -2 -absf aac_adtstoasc \
-r ${fps} \
${filename}
}
#
if [ "X${pass}" = "X1" ]
then
menc 0 ${output}
else
menc 1 /dev/null
menc 2 ${output}
fi