( hofi75 | 2009. 02. 09., h – 14:37 )

Sziasztok,

Sok guglizás után sikerült összekalapálnom egy bash scriptet, amivel mar 4CPU-van tudom konvertalni a .mkv-t .avi-ba. Ha valakinek van öttlete, hogy lehetne jobbá tenni a scriptet, akkor irjatok és beépítem. Hozzá kell tegyem, nagyon nem értek a bash script-hez, ezt is legalabb 3 órán keresztűl szültem.


#!/bin/bash

clear

NAME=`echo $1 | sed 's/\.[^.]*$//'`
D1=`mkvinfo $1 | grep Duration: | cut -d" " -f4 | cut -d. -f1`
QL=$((D1/4))

declare -a pids

function encode_part {
    num=$1
    ss=$(((num-1)*QL))
    echo "encoding $num will start at $ss"
    rm -fr $num
    mkdir $num
    cd $num
    mencoder -o $NAME.avi -alang hun -msglevel all=-1 -endpos $QL -ss $ss -oac copy -ovc xvid -xvidencopts bitrate=9500:vhq=4:pass=2:max_key_interval=200 ../$NAME.mkv & pid=$!
    cd ../
    pids[$num]=$pid
    echo "encoding started with pid $pid"
}

echo "Filename: $NAME"
echo "Duration: $D1 seconds"
echo "Quarter length $QL seconds"

for i in `seq 1 4`;
do
    encode_part $i
done

echo "wait until all process ends"
wait ${pids[1]}
wait ${pids[2]}
wait ${pids[3]}
wait ${pids[4]}

mencoder -forceidx -oac copy -ovc copy -o $NAME.avi 1/$NAME.avi 2/$NAME.avi 3/$NAME.avi 4/$NAME.avi
rm -fr 1
rm -fr 2
rm -fr 3
rm -fr 4

exit

Az elkészült avi file (csak videó és magyar hang) álltalában kissebb mint az mkv (ami persze függ az eredeti videó bitrate-től) és gond nélkül lejátszható PS3-on. Én MediaTomb-ot használok upnp szerverként. Minőségromlást nem tapasztaltam, igaz a plazmám csak kb 720p-t tud. Az összes CPU 100%-on pörög és tényleg negyed annyi idő kell az újrakódoláshoz.

Itt a kimenete egy rövid mkv konvertálásnak:


gabor@ubuntu:~/bin$ time mkv2avi rambo.mkv
Filename: rambo
Duration: 159 seconds
Quarter length 39 seconds
encoding 1 will start at 0
encoding started with pid 24411
encoding 2 will start at 39
encoding started with pid 24414
encoding 3 will start at 78
MEncoder 2:1.0~rc2-0ubuntu17 (C) 2000-2007 MPlayer Team
CPU: Intel(R) Core(TM)2 Quad CPU    Q6600  @ 2.40GHz (Family: 6, Model: 15, Stepping: 11)
CPUflags: Type: 6 MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 1
Compiled with runtime CPU detection.
encoding started with pid 24417
encoding 4 will start at 117
MEncoder 2:1.0~rc2-0ubuntu17 (C) 2000-2007 MPlayer Team
CPU: Intel(R) Core(TM)2 Quad CPU    Q6600  @ 2.40GHz (Family: 6, Model: 15, Stepping: 11)
CPUflags: Type: 6 MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 1
Compiled with runtime CPU detection.
encoding started with pid 24420
wait until all process ends
MEncoder 2:1.0~rc2-0ubuntu17 (C) 2000-2007 MPlayer Team
CPU: Intel(R) Core(TM)2 Quad CPU    Q6600  @ 2.40GHz (Family: 6, Model: 15, Stepping: 11)
CPUflags: Type: 6 MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 1
Compiled with runtime CPU detection.
Using SSE optimized IMDCT transform
Using MMX optimized resampler
MEncoder 2:1.0~rc2-0ubuntu17 (C) 2000-2007 MPlayer Team
CPU: Intel(R) Core(TM)2 Quad CPU    Q6600  @ 2.40GHz (Family: 6, Model: 15, Stepping: 11)
CPUflags: Type: 6 MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 1
Compiled with runtime CPU detection.
Using SSE optimized IMDCT transform
Using MMX optimized resampler
Using SSE optimized IMDCT transform
Using MMX optimized resampler
Using SSE optimized IMDCT transform
Using MMX optimized resampler
MEncoder 2:1.0~rc2-0ubuntu17 (C) 2000-2007 MPlayer Team
CPU: Intel(R) Core(TM)2 Quad CPU    Q6600  @ 2.40GHz (Family: 6, Model: 15, Stepping: 11)
CPUflags: Type: 6 MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 1
Compiled with runtime CPU detection.
success: format: 0  data: 0x0 - 0x1ba2ffc
AVI file format detected.
[aviheader] Video stream found, -vid 0
[aviheader] Audio stream found, -aid 1
AVI: Generated index table for 1016 chunks!
VIDEO:  [XVID]  1280x532  12bpp  23.976 fps  5473.3 kbps (668.1 kbyte/s)
[V] filefmt:3  fourcc:0x44495658  size:1280x532  fps:23.98  ftime:=0.0417
videocodec: framecopy (1280x532 12bpp fourcc=44495658)
audiocodec: framecopy (format=2000 chans=2 rate=48000 bits=16 B/s=56000 sample-1)
Writing header...
ODML: Aspect information not (yet?) available or unspecified, not writing vprp header.
Setting audio delay to 0.042s.
Writing header...
ODML: Aspect information not (yet?) available or unspecified, not writing vprp header.
Setting audio delay to 0.042s.
success: format: 0  data: 0x0 - 0x181fa7c:   0min  27mb  A-V:0.042 [5473:448]
AVI file format detected.
[aviheader] Video stream found, -vid 0
[aviheader] Audio stream found, -aid 1
AVI: Generated index table for 1016 chunks!
VIDEO:  [XVID]  1280x532  12bpp  23.976 fps  4720.1 kbps (576.2 kbyte/s)
[V] filefmt:3  fourcc:0x44495658  size:1280x532  fps:23.98  ftime:=0.0417
videocodec: framecopy (1280x532 12bpp fourcc=44495658)
audiocodec: framecopy (format=2000 chans=2 rate=48000 bits=16 B/s=56000 sample-1)
Pos:  39.5s    948f ( 1%) 495.04fps Trem:   2min 1865mb  A-V:0.083 [5492:448]
Skipping frame!
Pos:  39.9s    958f ( 3%) 499.74fps Trem:   1min 934mb  A-V:0.083 [5502:448]]
Skipping frame!
success: format: 0  data: 0x0 - 0x10fde52:   0min  51mb  A-V:0.081 [5094:448]
AVI file format detected.
[aviheader] Video stream found, -vid 0
[aviheader] Audio stream found, -aid 1
AVI: Generated index table for 1016 chunks!
VIDEO:  [XVID]  1280x532  12bpp  23.976 fps  3190.8 kbps (389.5 kbyte/s)
[V] filefmt:3  fourcc:0x44495658  size:1280x532  fps:23.98  ftime:=0.0417
videocodec: framecopy (1280x532 12bpp fourcc=44495658)
audiocodec: framecopy (format=2000 chans=2 rate=48000 bits=16 B/s=56000 sample-1)
Pos:  78.2s   1877f ( 0%) 459.71fps Trem:  13min 10232mb  A-V:0.085 [5098:448]
Skipping frame!
Pos:  78.6s   1887f ( 1%) 462.05fps Trem:   4min 3504mb  A-V:0.085 [5086:448]
Skipping frame!
Pos:  79.0s   1897f ( 2%) 450.81fps Trem:   2min 2179mb  A-V:0.085 [5078:448]
Skipping frame!
success: format: 0  data: 0x0 - 0x11556a8:   0min  68mb  A-V:0.078 [4461:448]
AVI file format detected.
[aviheader] Video stream found, -vid 0
[aviheader] Audio stream found, -aid 1
AVI: Generated index table for 1016 chunks!
VIDEO:  [XVID]  1280x532  12bpp  23.976 fps  3264.2 kbps (398.5 kbyte/s)
[V] filefmt:3  fourcc:0x44495658  size:1280x532  fps:23.98  ftime:=0.0417
videocodec: framecopy (1280x532 12bpp fourcc=44495658)
audiocodec: framecopy (format=2000 chans=2 rate=48000 bits=16 B/s=56000 sample-1)
Pos: 117.2s   2816f ( 0%) 469.41fps Trem:  14min 10103mb  A-V:0.086 [4463:448]
Skipping frame!
Pos: 117.6s   2826f ( 1%) 471.00fps Trem:   7min 5252mb  A-V:0.086 [4455:448]]
Skipping frame!
Pos: 118.0s   2836f ( 2%) 472.59fps Trem:   4min 3212mb  A-V:0.085 [4448:448]
Skipping frame!
Writing index...52f (100%) 482.88fps Trem:   0min  85mb  A-V:0.075 [4161:448]
Writing header...
ODML: Aspect information not (yet?) available or unspecified, not writing vprp header.
Setting audio delay to 0.042s.

Video stream: 4161.389 kbit/s  (520173 B/s)  size: 81228173 bytes  156.156 secs  3752 frames

Audio stream:  448.000 kbit/s  (56000 B/s)  size: 8736000 bytes  156.000 secs

real    1m30.369s
user    5m20.160s
sys     0m1.512s

eredmény:


gabor@ubuntu:~/bin$ ls -al
total 190888
drwxr-xr-x  2 gabor gabor       160 2009-02-09 14:29 .
drwxr-xr-x 64 gabor gabor      2912 2009-02-08 20:13 ..
-rwxr--r--  1 gabor gabor      1015 2009-02-08 20:02 mkv2avi
-rw-r--r--  1 gabor gabor  90067456 2009-02-09 14:29 rambo.avi
-rw-rw-rw-  1 gabor gabor 105194599 2008-07-30 23:56 rambo.mkv

Üdv,
Gábor