From owner-freebsd-questions@freebsd.org Sat Jan 6 20:31:10 2018 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2339EDDBB7F for ; Sat, 6 Jan 2018 20:31:10 +0000 (UTC) (envelope-from ultima1252@gmail.com) Received: from mail-yw0-x22e.google.com (mail-yw0-x22e.google.com [IPv6:2607:f8b0:4002:c05::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D18847E2D9 for ; Sat, 6 Jan 2018 20:31:09 +0000 (UTC) (envelope-from ultima1252@gmail.com) Received: by mail-yw0-x22e.google.com with SMTP id y126so718007ywy.2 for ; Sat, 06 Jan 2018 12:31:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=EVsbuGTm7fEachhOtkTYvtWVHBTfskKsq0SwSerq8f0=; b=uBmJkfou0ODl5B4G/B5xwjfoBKmWQ723GfT7SyBfEAObBLEYFs1Wsh02cN7DybAGCP 1NGKidcOhbzzi+SQO0nRirUcpT3088p8G6Hi0HtyBCP25q4I7zYF2+asjSvCR4wEyoco gOXL6eE669EgNE+BKqHYxbJgGuv7VDZ0bsDa2aXQvOVblBx8DrjcIVN32JZqUpaHnE9X UWEwT4ape0hDR83el4NrMh3RDzc48yqewTe49rABaFqJcqNBPZh/8C/Jgb75/zr1RJ/X +z77/eiUOHaBkOiMZm9FYfjFJYulDrV0edotCCXu3PrEsxtFEZzghCOLcGEoxHuVbASx VMFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=EVsbuGTm7fEachhOtkTYvtWVHBTfskKsq0SwSerq8f0=; b=qqRMYDBXu8Det3waUNi7H59TH4xBMEK12eXmCbp22ePye0tkpFCKKtK4okQy6+BL8M 3TO1CZHmtMiZeXACayUYHMni4jbtu6EMkPWOoa6AJezmdYo3kCVMSpSLt0l4RjpZjGGZ 5adfdTPxr8NzohHhKPXZvXLcb+dl1tXAnRYpUG6rH9ZyIQ/JUm+izbYkKuoiLA3DEo9A 9SqCnzN2XVamb+uUX83SWorVwCqAs+QBFznfebZwSooSuWdKg2QgrGLWcYtc9Eegt4Qj 9qTekOXLyKAxIhflu7i/X7uPDoEm7NZkUm61Sh8WkdBDH9hHGVOJUMQwsU7SAUpEgpJ8 VEKw== X-Gm-Message-State: AKGB3mJBzUo7vRLPy37EP6AKXnomiHKl/i+UxZ7IBAymOMMEwkjb461N +RUhCv6BR/bw1rhjiwYMvMPlzSpNTCFcJ5ke0oj5sw== X-Google-Smtp-Source: ACJfBouuRHwbfsGCZb79IpraFXGcVOdRFP8GkA09+cqV0clZNAF9VJDfPDTNViI0zfivlEHGdMcySd6aiutOHbvVrfo= X-Received: by 10.129.91.139 with SMTP id p133mr6482006ywb.280.1515270668849; Sat, 06 Jan 2018 12:31:08 -0800 (PST) MIME-Version: 1.0 Received: by 10.129.174.3 with HTTP; Sat, 6 Jan 2018 12:31:08 -0800 (PST) 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> <20180106151754.GA35747@admin.sibptus.transneft.ru> <06f10c10-8e39-ec9b-de84-0c345c8be229@gmail.com> From: Ultima Date: Sat, 6 Jan 2018 12:31:08 -0800 Message-ID: Subject: Re: Convert .flac and .ape to mp3 To: Andreas Perstinger Cc: FreeBSD Mailing List Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Jan 2018 20:31:10 -0000 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 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 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" >