You are not logged in.

#1 2011-01-26 17:03:58

kolbycrouch
Member
Registered: 2008-07-18
Posts: 218

ffmpeg no overwrite

Well it seems google has let me down again, so i'll ask here.

I'm using a script that converts all flash(flv) videos into mp3 audio. My only problem is that there doesn't seem to be anyway to automatically select no when asked to overwrite a file. there is an -y option that automatically overwrites everything, but not the opposite.

Offline

#2 2011-01-26 17:06:24

Inxsible
Forum Fellow
From: Chicago
Registered: 2008-06-09
Posts: 9,183

Re: ffmpeg no overwrite

kolbycrouch wrote:

.....I'm using a script....

Which script?


Forum Rules

There's no such thing as a stupid question, but there sure are a lot of inquisitive idiots !

Offline

#3 2011-01-26 17:48:05

SS4
Member
From: !Rochford, Essex
Registered: 2010-12-05
Posts: 699

Re: ffmpeg no overwrite

FFmpeg can handle conversions directly. I'm not sure about batch conversions though

ffmpeg -i INPUT.flv -vn -acodec copy OUTPUT.m4a

Rauchen verboten

Offline

#4 2011-01-26 18:13:52

kolbycrouch
Member
Registered: 2008-07-18
Posts: 218

Re: ffmpeg no overwrite

@inxsible, I just made a little two liner.

 youtube-dl -w -l --batch-file=/home/kolby/.youtube2music/youbatch
for f in *.flv; do ffmpeg -i /home/kolby/.youtube2music/"$f" -acodec libmp3lame -ab 128k /home/kolby/Music/"${f%.flv}.mp3"; done 

@SS4 Well the script is making it do a batch conversion, I just need it to never overwrite anything.

Edit: i also you a nice keybinding that goes something like this

 xsel --clipboard >> /home/kolby/.youtube2music/youbatch && echo  >> ~/.youtube2music/youbatch 

this lets my echo a copied link into my batch file. I know the blank echo looks odd, but for whatever reason, xsel doesn't do a newline which seems to be fixed by echo.

Last edited by kolbycrouch (2011-01-26 18:16:49)

Offline

#5 2011-01-26 18:24:35

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: ffmpeg no overwrite

You can try

echo "n" | <some command to ask you y/n>

Offline

#6 2011-01-26 18:40:38

kolbycrouch
Member
Registered: 2008-07-18
Posts: 218

Re: ffmpeg no overwrite

karol wrote:

You can try

echo "n" | <some command to ask you y/n>

Ahh that does the trick, I'm not very used to using pipes, maybe its because sed is so disgusting in its input that its turned me off smile

Offline

#7 2011-01-26 19:00:55

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: ffmpeg no overwrite

Ummm, I don't know what does sed have to do with pipes, but yes, sed's expressions can be pretty ... ugly.

Do you know what will happen if you select 'no'? Maybe you would like the script to create a new file named 'somefile.mp3.1' if 'somefile.mp3' already exists?

Edit: youtube-dl; has 'autonumber' option that may come in handy.
Edit2: Or it may be not needed at all as youtube-dl's '-l' option pretty much assures the filename will be unique.

Last edited by karol (2011-01-26 20:13:40)

Offline

#8 2013-01-18 07:58:02

p4l4cl][n
Member
Registered: 2011-11-16
Posts: 43

Re: ffmpeg no overwrite

Hi,
from ffmpeg documentation:

‘-y (global)’
Overwrite output files without asking.

‘-n (global)’
Do not overwrite output files but exit if file exists.

( source: http://ffmpeg.org/ffmpeg.html )

What you want is the second option.

Offline

Board footer

Powered by FluxBB