Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: flac overwriting existing files, while ffmpeg does not (Read 3973 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

flac overwriting existing files, while ffmpeg does not

So, a while ago I put together a set of scripts to convert stuff into .flac with my preferred settings. But I learned that libflac is quite a bit more efficient than ffmpeg's Lavf58.
Took a gander at flac's manpage, picked out the options that I (think) resemble what I did with ffmpeg, and go to test.

For use with ffmpeg, I set up 2 scripts, an init one and a worker script. The init basically just starts as many workers as there are cores on the system. Now when I replace my ffmpeg command with the flac one, flac starts to overwrite and (presumably) write into files created by other worker processes. Is flac already multithreaded to begin with?

Some info: the init and worker script running on Manjaro Linux, using flac 1.3.2-2
Code: [Select]
pacman -Si flac
Repository      : extra
Name            : flac
Version         : 1.3.2-2
Description     : Free Lossless Audio Codec
Architecture    : x86_64
URL             : http://flac.sourceforge.net/
Licenses        : BSD  GPL
Groups          : None
Provides        : None
Depends On      : gcc-libs  libogg
Optional Deps   : None
Conflicts With  : None
Replaces        : None
Download Size   : 376,21 KiB
Installed Size  : 1332,00 KiB
Packager        : Evangelos Foutras <evangelos@foutrelis.com>
Build Date      : Sa 10 Nov 2018 00:18:08 CET
Validated By    : MD5 Sum  SHA-256 Sum  Signature

Re: flac overwriting existing files, while ffmpeg does not

Reply #1
Barring some race condition, flac should exit/continue with next file if the destination file already exists.

Btw, are you sure you want to use --force-raw-format option?

Re: flac overwriting existing files, while ffmpeg does not

Reply #2
For use with ffmpeg, I set up 2 scripts, an init one and a worker script. The init basically just starts as many workers as there are cores on the system. Now when I replace my ffmpeg command with the flac one, flac starts to overwrite and (presumably) write into files created by other worker processes. Is flac already multithreaded to begin with?

Unless I'm misunderstanding, since you've hard coded the path, I think you are telling all workers to transcode the same file.  Probably you want to either give each worker a different list of files, or have the first worker do file 1, 5, 9 ...

In addition to forcing raw when you don't have raw files, your script looks for MP4 files but you never actually call an MP4 decoder.

 

Re: flac overwriting existing files, while ffmpeg does not

Reply #3
Unless I'm misunderstanding, since you've hard coded the path, I think you are telling all workers to transcode the same file.  Probably you want to either give each worker a different list of files, or have the first worker do file 1, 5, 9 ...
I believe OP is counting on the fact that only one worker will actually start encoding a given file while others will get error that the destination already exists and they will try with the next file.