Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[TIP] Masterizzare un SVCD con gentoo
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Forum italiano (Italian) Risorse italiane (documentazione e tools)
View previous topic :: View next topic  
Author Message
Ginko
Guru
Guru


Joined: 01 May 2002
Posts: 371
Location: nearby my linux laptop

PostPosted: Wed Oct 22, 2003 12:47 pm    Post subject: [TIP] Masterizzare un SVCD con gentoo Reply with quote

Ciao,

come da oggetto. Avete bisogno di
    media-video/transcode
    media-video/mjpegtools
    media-video/vcdimager
    app-cdr/cdrdao
    media-video/mplayer

Lo script per rendere l'operazione piu' semplice e' :
Code:
#!/bin/sh
#
######################################################################
#
#       __  ___      __            ______    ____________
#      /  |/  /___ _/ /_____      / ___/ |  / / ____/ __ \
#     / /|_/ / __ `/ //_/ _ \     \__ \| | / / /   / / / /
#    / /  / / /_/ / ,< /  __/    ___/ /| |/ / /___/ /_/ /
#   /_/  /_/\__,_/_/|_|\___/____/____/ |___/\____/_____/
#                         /_____/
#
#  Created on:   Thu Oct 16 22:32:16
#  Author:       Gianluca rotoni, Software Engineer
#
#  Copyright (C) 2003 Gianluca Rotoni <gianluca@rotoni.com>
#
#  This program is free software; you can redistribute it and/or
#  modify it under the terms of the GNU General Public License
#  as published by the Free Software Foundation; either version 2
#  of the License, or (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 59 Temple Place - Suite 330,
#  Boston, MA  02111-1307, USA.
#
######################################################################
#
# Create, burn and play an SVCD out of a mpeg file

#
# Binaries locations
#
ECHO=/bin/echo
RM=/bin/rm
MKDIR=/bin/mkdir

#
# Print header
#
$ECHO "Make_SVCD (c) Rotoni Gianluca"
$ECHO "A GPL script to create, burn and play SVCD"
$ECHO

#
# Check whether all required software is installed
#
err=0
for bin in transcode mplex vcdimager cdrdao mplayer mpeg2enc; do
  type $bin >/dev/null 2>&1
  if [ $? -ne 0 ]; then
    err=1
    $ECHO "$bin not found"
  fi
done

if [ $err -eq 1 ]; then
  $ECHO "Missing vital software, please install before continuing"
  exit 1
fi

#
# Read autoconfig, if exist
#
if [ ! -z $HOME -a -f $HOME/.makesvcdrc ]; then
  source $HOME/.makesvcdrc
fi

#
# Read user settings
#
$ECHO -n "Enter location of source movie file [$src_prev]: "
read src

if [ -z $src ]; then
  src=$src_prev
fi

if [ -z $src ]; then
  $ECHO "Must specify a source file"
  exit 1
fi

if [ ! -f $src ]; then
  $ECHO "$src no such file or directory"
  exit 1
fi

$ECHO -n "Enter destination directory [$destdir_prev]: "
read destdir

if [ -z $destdir ]; then
  destdir=$destdir_prev
fi

if [ -z $destdir ]; then
  destdir=.
fi

if [ ! -d $destdir ]; then
  $ECHO -n "$destdir not found, creating... "
  $MKDIR $destdir 2>/dev/null
  if [ $? -ne 0 ]; then
    $ECHO "nok!"
    exit 1
  else
    $ECHO "done!"
  fi
fi

$ECHO -n "Enter output base filename [$filename_prev]: "
read filename

if [ -z $filename ]; then
  filename=$filename_prev
fi

if [ -z $filename ]; then
  $ECHO "Must specify a file name!"
  exit 1
fi

$ECHO -n "Enter movie title [$filename] : "
read title

if [ -z "$title" ]; then
  title=$filename
fi

$ECHO -n "Shall I delete all working files after the creation process (y/N)? "
read delete

if [ -z $delete ]; then
  delete="N"
fi

$ECHO -n "Shall I burn the SVCD right after the creation process (y/N)? "
read burn

if [ -z $burn ]; then
  burn="N"
else
  if [ $burn == "y" -o $burn == "Y" ]; then
    $ECHO "Remember to put a fresh CD-R into the CD writer before proceeding"
    $ECHO
    $ECHO -n "Enter burning device [$device_prev] : "
    read device

    if [ -z $device ]; then
      device=$device_prev
    fi

    if [ -z $device ]; then
      $ECHO "Device $device not found"
      exit 1
    fi

    if [ ! -r $device ]; then
      $ECHO "Device $device not found"
      exit 1
    fi

    $ECHO -n "Shall I play the SVCD right after the burning process (y/N)? "
    read play
    if  [ -z $play ]; then
      play="N"
    fi
  fi
fi

#
# Write the autoconfig file
#
if [ ! -z $HOME ]; then
  $ECHO "src_prev=$src; export src_prev" > $HOME/.makesvcdrc
  $ECHO "destdir_prev=$destdir; export destdir_prev" >> $HOME/.makesvcdrc
  $ECHO "filename_prev=$filename; export filename_prev" >> $HOME/.makesvcdrc
  $ECHO "device_prev=$device; export device_prev" >> $HOME/.makesvcdrc
fi

#
# Transform the MPEG file into SVCD format, extract audio onto MPA file
#
transcode -N 0x50 -V -i $src -y mpeg2enc,mp2enc -F 5 -E 44100 -b 224 -o $destdir/$filename

#
# Merge audio and video files
#
if [ -f $destdir/$filename.m2v -a $destdir/$filename.mpa ]; then
  mplex -V -f 5 -o $destdir/$filename.mpg  $destdir/$filename.m2v $destdir/$filename.mpa
else
  $ECHO "transcode didn't produce expected output, exiting"
  exit 1
fi

#
# Produce a SVCD file set (cue + bin files)
#
if [ -f $destdir/$filename.mpg ]; then
  vcdimager -t svcd -l "$title" -c $destdir/$filename.cue -b $destdir/$filename.bin $destdir/$filename.mpg
else
  $ECHO "mplex didn't produce expected output, exiting"
  exit 1
fi

#
# Brun SVCD if required
#
if [ -f $destdir/$filename.cue -a $destdir/$filename.bin ]; then
  if [ $burn == "y" -o $burn == "Y" ]; then
    cdrdao write --device $device $destdir/$filename.cue

    #
    # Play SVCD if required
    #
    if [ $play == "y" -o $play == "Y" ]; then
      mplayer vcd://2 -cdrom-device $device
    fi
  fi
else
  $ECHO "vcdimager didn't produce expected output, exiting"
  exit 1
fi

#
# Deletes working files if required
#
if [ $delete == "y" -o $delete == "Y" ]; then
  $RM -f $destdir/$filename.m2v
  $RM -f $destdir/$filename.mpa
  $RM -f $destdir/$filename.mpg
fi


Saluti
--Gianluca
Back to top
View user's profile Send private message
fedeliallalinea
Bodhisattva
Bodhisattva


Joined: 08 Mar 2003
Posts: 13200
Location: here

PostPosted: Thu Oct 23, 2003 10:57 am    Post subject: Reply with quote

Sei troppo un grande. Ci vediamo presto :wink: .
_________________
"aspetto un'emozione sempre più indefinibile"
- CCCP -
"la libertà un doveroso pericolo in verità"
- PGR -
Questions are guaranteed in life; Answers aren't.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Forum italiano (Italian) Risorse italiane (documentazione e tools) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum