LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 08-24-2008, 02:03 PM   #1
Anithen
Member
 
Registered: Aug 2003
Location: Florida
Distribution: Slackware 12, Slackware 12.1, Slackware 12.2
Posts: 105

Rep: Reputation: 15
Feed multiple files into ffmpeg?


I've always done things, like

for i in *.mp3; do mpg321 -w `basename $i .mp3`.wav $i; done

but for ffmpeg how can I encode many videos at once?

for i in *.3gp; do ffmpeg $i -f avi -vcodec libxvid -acodec libmp3lame `date +%H%M%S%N`.avi; done

Does not work, because ffmpeg uses the 2nd match as the output file, and asks me if I want to write over it.

From within a directory full of 3gp files, I ran

find . -iname "*.3gp" -print -exec ~/nastiness/3gp2avi.sh {} \;

, and 3gp2avi.sh contains

#!/bin/bash ffmpeg $1 -f avi -vcodec libxvid -acodec libmp3lame `date +%H%M%S%N`cv.avi

This attempt also does not work. Strangely, even using 3gp2avi.sh by itself on 1 file ffmpeg tries using the filename as the output file filename. If I type the whole ffmpeg command one by one for each 3gp file it works, though.

If anyone can help me do something like "for i in *3gp; do..." with ffmpeg I'd greatly appreciate it. Thanks.

Last edited by Anithen; 08-24-2008 at 04:41 PM. Reason: clarification
 
Old 08-24-2008, 11:40 PM   #2
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
The command should be 'ffmpeg -i "$i" etc..'. I'd also put the variable in quotes, especially if the filenames contain spaces or other illegal characters. Same goes for the output file string.
 
Old 08-25-2008, 01:13 AM   #3
Anithen
Member
 
Registered: Aug 2003
Location: Florida
Distribution: Slackware 12, Slackware 12.1, Slackware 12.2
Posts: 105

Original Poster
Rep: Reputation: 15
Thanks, David the H. I can't believe I missed the -i. It's in my bash history. I must've weeded it out accidentally during testing. One thing I wouldn't have tried is using "$i" vs $i, so thank you for your help.

My final command is

for i in *.3gp; do ffmpeg -i "$i" -f avi -vcodec libxvid -acodec libfaac -ar 22050 `basename $i .3gp`-`date +%H%M%S%N`.avi; done
 
  


Reply

Tags
ffmpeg



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How do you split mpg files using a ffmpeg command? milkjerry3 Linux - Newbie 19 05-12-2011 08:09 AM
ffmpeg and multistream WMV files jroyce Linux - Software 2 01-17-2008 10:07 PM
Looking for RSS & Atom Feed (News Feed)? suse2166 Linux - Software 2 11-16-2006 04:58 PM
splitting video files with ffmpeg triXlife Linux - Software 0 12-27-2005 07:29 PM
which files do I need for ffmpeg? akihandyman Linux - Software 1 12-02-2003 08:12 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

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

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration