Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 6 Jan 2018 12:31:08 -0800
From:      Ultima <ultima1252@gmail.com>
To:        Andreas Perstinger <andipersti@gmail.com>
Cc:        FreeBSD Mailing List <freebsd-questions@freebsd.org>
Subject:   Re: Convert .flac and .ape to mp3
Message-ID:  <CANJ8om6X4BgZtd--3ddEyOY4yBMNAOpSNmaDqVUa=4FAWtMmrg@mail.gmail.com>
In-Reply-To: <06f10c10-8e39-ec9b-de84-0c345c8be229@gmail.com>
References:  <20180104163421.GA15692@admin.sibptus.transneft.ru> <20180104175156.440fa0c2.freebsd@edvax.de> <20180106063934.GA32231@admin.sibptus.transneft.ru> <op.zce38vcag7njmm@workstation> <20180106151754.GA35747@admin.sibptus.transneft.ru> <06f10c10-8e39-ec9b-de84-0c345c8be229@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Thanks for the link Andreas, it is a good read.

Was very tired when I made the reply yesterday so
apologies for not double checking and explaining my
minimal responses.

I want to also mention if you want to build a more
reliable script, you should also check if the file is
actually the media format suggested by the extension.

My solution to this problem is first checking if an error
occurs when ffprobe runs the file with -loglevel -8 options.
This will verify that ffmpeg can actually read the file. Next
run it a second time to verify the media format.

ffprobe is very fast so you don't have to worry about taking
a performance hit.

These are just some of the checks that I run before
processing any media and I recommend it for preventing
headaches later.

Best regards,
Richard Gallamore

On Sat, Jan 6, 2018 at 8:12 AM, Andreas Perstinger <andipersti@gmail.com>
wrote:

> On 2018-01-06 16:17, Victor Sudakov wrote:
>
>> Michael Ross wrote:
>>
>>> > #!/bin/sh
>>> > for i in `find . -iname '*.ape'`
>>> > do
>>> >   do_something $i
>>> > done
>>> >
>>> > breaks on spaces.
>>> >
>>> > What is the sh magic to handle such filenames?
>>> >
>>>
>>> xargs, you may want to run a few conversions in parallel:
>>>
>>> find . -iname '*.ape' -print0 | xargs -0 -I% -P<parallel_runs> convert
>>> %  %.mp3
>>>
>>
>> I'm sure there are many ways to solve the problem, including writing a
>> C program, but a solution in pure sh has its own value and appeal.
>>
>
> Well, you use already the find command, so why don't you use it's full
> power?
>
> https://unix.stackexchange.com/questions/321697
> (Why is looping over finds output bad practice?)
>
> Bye, Andreas
>
> _______________________________________________
> freebsd-questions@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe
> @freebsd.org"
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANJ8om6X4BgZtd--3ddEyOY4yBMNAOpSNmaDqVUa=4FAWtMmrg>