ALT Linux Community general discussions
 help / color / mirror / Atom feed
From: "Dmytro O. Redchuk" <brownian.box@gmail.com>
To: ALT Linux Community general discussions <community@lists.altlinux.org>
Subject: Re: [Comm] Конвертирование видео
Date: Fri, 22 May 2009 09:35:29 +0300
Message-ID: <8409fdee0905212335k28bdca2ey645bc2a123d39a53@mail.gmail.com> (raw)
In-Reply-To: <1e7e0a9a0905202209p704776c8idd17a4c0e1dee9e3@mail.gmail.com>

2009/5/21 Il'ya <brutalfreak@gmail.com>:
> Подскажите пожалуйста как наиболее быстро и просто конвертировать из
> одного формата в другой (не консольными способами).
Если не консоль, то достаточно просто и удобно один раз все сделать
в Avidemux, сохранить как "сценарий",
сделать из него шаблон и шелловским скриптом заполнять шаблон
"параметрами" ($src, $dst, $target_size, например..).

То есть, потом таки перейти в консоль :-)

Можно создать несколько шаблонов (с отсечением полос либо без, и т.п.).

Вот кусок моего "шаблона"
(НЕ УВЕРЕН, ЧТО РАБОТАЕТ, я "перешел" на mencoder),
он берет два аргумента -- имя файла и "во сколько раз уменьшить размер"
(понятно, что можно иначе "строить политику"), и создает сценарий для Avidemux.

Делалось для перегона сграбленого HDV в "подходящий для записи на DVD".
Да, он еще попутно сохраняет звук в отдельном mp3.

#------------------------------------------------------------------

#!/bin/bash
#
#

SRC=${1:?"Please specify input file."}
squeeze_factor=${2:-5}

SRC=$(pwd)/${SRC}
DST=${SRC}.mpg
AUDIO=${SRC}.mp3
SCRIPT=${SRC}.js

if [ ! -f $SRC ] ; then
        echo -e "\nERROR: File \"$SRC\" does not exist or is a special file.\n"
        exit 1
fi


size=`ls -s $SRC | awk '{ print $1 }'`

squeeze_size=$((size/1024/$squeeze_factor))

echo -e "\nVideo size: $[size/1024]M, squeeze factor: $squeeze_factor,
squeezed size: ${squeeze_size}M.\n"


cat << SCRIPT > $SCRIPT
//AD  <- Needed to identify//

var sourcefile = "$SRC";
var targetfile = "$DST";
var audiofile  = "$AUDIO";

var app = new Avidemux();

//** Video **

// Load the file
app.forceUnpack();
app.load(sourcefile);
app.rebuildIndex();

//** Postproc **
app.video.setPostProc(3,3,0);
app.video.setFps1000(25000);

//** Video Codec conf **
app.video.addFilter("coloryuv","gain=128");
app.video.addFilter("mphqdenoise3d","param1=4,000000","param2=3,000000","param3=6,000000");
app.video.addFilter("mpresize","w=720","h=576","algo=1");
app.video.addFilter("asharp","t=2,500000","d=1,000000","b=-1,000000","bf=0");
// app.video.addFilter("addblack","left=3","right=3","top=7","bottom=7");

//** Video Codec conf **
app.video.codec("XDVD","2PASS=$squeeze_size","168 05 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 02 00 00 00 1f 00 00 00 03 00
00 00 02 00 00 00 01 00 00 00 01 00 00 00 fe ff ff ff 01 00 00 00 fb
ff ff ff cd cc 4c 3d 01 00 00 00 0a d7 23 3c 01 00 00 00 00 00 00 3f
00
 00 00 3f 00 00 00 00 40 1f 00 00 01 00 00 00 0c 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 00 00 0
0 02 00 00 00 40 1f 00 00 00 00 00 00 00 00 00 3f 00 00 00 00 00 00 00
3f 00 00 00 00 01 00 00 00 e0 00 00 00 00 00 00 00 00 00 00 00 ");

//** Audio **
app.audio.reset();
app.audio.codec("lame",128,16,"00 00 00 00 01 00 00 00 02 00 00 00 00
00 00 00 ");
app.audio.normalizeMode=0;
app.audio.normalizeValue=0;
app.audio.delay=0;
app.audio.mixer("NONE");
app.setContainer("AVI");
app.audio.save(audiofile);


//** Audio **
app.audio.reset();
app.audio.codec("twolame",128,4,"01 00 00 00 ");
app.audio.normalizeMode=0;
app.audio.normalizeValue=0;
app.audio.delay=0;
app.audio.mixer("NONE");
app.setContainer("PS");

app.save(targetfile);

//End of script
SCRIPT

#------------------------------------------------------------------


Скрипт для прогона *всех* сценариев в каталоге:

#------------------------------------------------------------------
for js in *js; do
        SCRIPTS="${SCRIPTS} --run ${js}"
done

avidemux --nogui --autoindex ${SCRIPTS} --quit
#------------------------------------------------------------------

-- 
Dmytro O. Redchuk

      parent reply	other threads:[~2009-05-22  6:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-21  5:09 Il'ya
2009-05-21  7:06 ` Motsyo Gennadi aka Drool
2009-05-21  8:36   ` Occisor
2009-05-21  9:08     ` Motsyo Gennadi aka Drool
2009-05-21 11:23       ` Grigory Batalov
2009-05-21  7:31 ` Константин Михайленко
2009-05-22  4:05 ` Геннадий Ищенко
2009-05-22  6:35 ` Dmytro O. Redchuk [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8409fdee0905212335k28bdca2ey645bc2a123d39a53@mail.gmail.com \
    --to=brownian.box@gmail.com \
    --cc=community@lists.altlinux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux Community general discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/community/0 community/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 community community/ http://lore.altlinux.org/community \
		mandrake-russian@linuxteam.iplabs.ru community@lists.altlinux.org community@lists.altlinux.ru community@lists.altlinux.com
	public-inbox-index community

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.community


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git