You are not logged in.

#1 2016-04-21 08:43:47

wma
Member
Registered: 2015-09-07
Posts: 10

[solved] parallel and ffmpeg

Hi,

I used to use ffmpeg with parallel to convert my FLAC audio files to MP3 or Opus. Specifically, I used either of these commands:

parallel ffmpeg -i {} -qscale:a 0 {.}.mp3 ::: *.flac

(taken from the Arch Wiki)

parallel ffmpeg -i {} -map 0:a -c:a libopus -b:a 96000 {.}.opus ::: *.flac

Today, however, I ran into an issue that I can't figure out. The commands seem to be working fine, but when it's almost at the end converting the last file, parallel will become unresponsive. I have no idea why. If I ctrl + C at that point, every file but the last will have been converted. Ffmpeg converts this file successfully if I run it directly, without parallel. It also works with parallel-moreutils. So it seems to be a GNU Parallels issue, but I'm at a loss. Does anybody know where would be the problem?

Thanks

Last edited by wma (2016-04-21 18:30:42)

Offline

#2 2016-04-21 10:36:03

Vain
Member
Registered: 2008-10-19
Posts: 183

Re: [solved] parallel and ffmpeg

I remember similar issues.

STDIN of all the ffmpeg processes is a pipe. Except for one process, though, which has STDIN set to your terminal. Apparently, at some point, this one process receives a signal like SIGTTIN, probably because it's being "moved to the background" by parallel. This causes the process to halt. You can check that in "ps aux | grep ffmpeg" or htop: You'll see that the process' state is "T".

In your case, the problem can be worked around like this:

parallel ffmpeg -i {} -qscale:a 0 {.}.mp3 \</dev/null ::: *.flac

Sorry, I have no idea why this happens. It kind of smells like a bug in parallel (or a fundamental misunderstanding how parallel works).

Last edited by Vain (2016-04-21 10:36:29)

Offline

#3 2016-04-21 18:30:02

wma
Member
Registered: 2015-09-07
Posts: 10

Re: [solved] parallel and ffmpeg

Thank you! It worked.

It must be a recent change in parallel because it used to work just fine without the workaround.

Last edited by wma (2016-04-21 18:32:03)

Offline

Board footer

Powered by FluxBB