LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 08-09-2004, 03:00 PM   #1
tutwabee
Member
 
Registered: Jan 2004
Location: California
Distribution: Ubuntu 10.04
Posts: 145

Rep: Reputation: 15
two shell script questions


I am making a script which uses mplayer/mencoder to rip a dvd, crop it, combine two mpegs from seperate disks if necessary, and convert to an avi if necessary. At the moment I have a perl script that does the file combining and I can't find a way to make a shell script that grabs the crop value from the command 'mplayer -ao null -vo xv -vop cropdetect [filename]'

1: Does anyone know how I can use shell to combine two files?
2: Does anyone know how I can get the crop value from the cropdetect output?

The current perl script I am using to combine the files is:
Quote:
#!/usr/bin/perl


# open FIRSTFILE, "1.mpeg";
# @firstfile = <FIRSTFILE>;
# close FIRSTFILE;

open SECONDFILE, "2.mpeg";
@secondfile = <SECONDFILE>;
close SECONDFILE;

open FULLFILE, ">>full.mpeg";
# foreach $line (@firstfile) {
# print FULLFILE $line;
# }

foreach $line (@secondfile) {
print FULLFILE $line;
}

close FULLFILE;
 
Old 08-10-2004, 05:39 AM   #2
JZL240I-U
Senior Member
 
Registered: Apr 2003
Location: Germany
Distribution: openSuSE 13.1 / 12.3_64-KDE, Ubuntu 14.04, Fedora 20, Mint 17, Chakra
Posts: 3,644

Rep: Reputation: Disabled
Look at this http://www.tldp.org/guides.html#abs
 
Old 08-10-2004, 02:38 PM   #3
bulliver
Senior Member
 
Registered: Nov 2002
Location: Edmonton AB, Canada
Distribution: Gentoo x86; Gentoo PPC; Gentoo Sparc64; FreeBSD; OS X; Solaris
Posts: 3,731
Blog Entries: 4

Rep: Reputation: 66
1: By using the concatanate (cat) command of course. Here's an example:
Code:
me@mine]$ echo "aaaaaaaaaaaaaaa" > a.txt
me@mine]$ echo "bbbbbbbbbbbbbbb" > b.txt
me@mine]$ cat a.txt b.txt
aaaaaaaaaaaaaaa
bbbbbbbbbbbbbbb
me@mine]$ cat a.txt b.txt > c.txt
me@mine]$ cat c.txt
aaaaaaaaaaaaaaa
bbbbbbbbbbbbbbb
me@mine]$
The formula is "cat file1 file2 > file3"
So: "cat 1.mpeg 2.mpeg > 3.mpeg"

2. output redirection is accomplished using the backtick operator:
Code:
me@mine]$ FOO=`uptime`
me@mine]$ echo $Foo
12:36:36 up 18:43,  1 user,  load average: 0.04, 0.05, 0.00
me@mine]$
So: FOO=`mplayer -ao null -vo xv -vop cropdetect [filename]`

Last edited by bulliver; 08-10-2004 at 02:44 PM.
 
Old 08-10-2004, 02:45 PM   #4
tutwabee
Member
 
Registered: Jan 2004
Location: California
Distribution: Ubuntu 10.04
Posts: 145

Original Poster
Rep: Reputation: 15
Thank you bulliver. I hadn't thought of using the cat command in that way before.
 
Old 08-10-2004, 06:03 PM   #5
bulliver
Senior Member
 
Registered: Nov 2002
Location: Edmonton AB, Canada
Distribution: Gentoo x86; Gentoo PPC; Gentoo Sparc64; FreeBSD; OS X; Solaris
Posts: 3,731
Blog Entries: 4

Rep: Reputation: 66
No problem. The only thing I am not sure of is if it will work on binary files (ie: video clips). Perhaps it only works on text files?

EDIT: I just tried it on a couple of mp3 files and it worked flawlessly using cat.

Last edited by bulliver; 08-10-2004 at 06:08 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Shell script inside shell script treotan Linux - General 4 02-19-2009 06:34 AM
Shell Scripting: Getting a pid and killing it via a shell script topcat Programming 15 10-28-2007 02:14 AM
shell script problem, want to use shell script auto update IP~! singying304 Programming 4 11-29-2005 05:32 PM
Couple of Shell Script Questions mathias1979 Programming 3 06-16-2005 03:22 PM
Shell Script Questions Col Panic Linux - General 13 10-12-2003 12:51 PM


All times are GMT -5. The time now is 07:08 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration