3

I have some files

Joapira___BERLINA_DEL_HIERRO.mp4
Joapira___EL_BAILE_DEL_VIVO.mp4
Joapira___EL_CONDE_CABRA.mp4
Joapira___FLAIRE.mp4
Joapira___MAZULKA_DEL_HIERRO.mp4
Joapira___MEDA_A_MANOLITO_DIAZ_ARTESANO_TALLISTA.mp4

that I want to convert to some other formats with ffmpeg and GNU parallel. For example to convert them to flac I do

parallel --bar ffmpeg -i "{}" -map_metadata 0 "{/.}.flac" ::: *

or to convert them to mp3 I do

parallel --bar ffmpeg -i "{}" -vn -ar 44100 -ab 128k -map_metadata 0 "{/.}.mp3" ::: $@

but the process continues forever and the first file is always missing. Why?

Info

I am on Fedora 22 using

GNU parallel 20160222

and

ffmpeg version N-80953-gd4c8e93-static http://johnvansickle.com/ffmpeg/

Update

Fascinating, I tried it with ffmpeg version 2.6.8 (comes with Fedora) and it works!! And even with the most recent static build from git it does not. :-(

Update 2

When I run ps auxwww and search for ffmpeg I see all the jobs with the state Rl, except for the command of the file that is missing, which has the state T.

GNU parallel has the state S+, but sometimes during the processing of the working files changes to R+.

The man page of ps says the following about the states:

D    uninterruptible sleep (usually IO)
R    running or runnable (on run queue)
S    interruptible sleep (waiting for an event to complete)
T    stopped by job control signal
t    stopped by debugger during the tracing
W    paging (not valid since the 2.6.xx kernel)
X    dead (should never be seen)
Z    defunct ("zombie") process, terminated but not reaped by its parent

<    high-priority (not nice to other users)
N    low-priority (nice to other users)
L    has pages locked into memory (for real-time and custom IO)
s    is a session leader
l    is multi-threaded (using CLONE_THREAD, like NPTL pthreads do)
+    is in the foreground process group

Maybe this helps to understand the problem.

  • Fascinating, I tried it with ffmpeg version 2.6.8 Copyright (comes with Fedora) and it works!! But even with the most recent static build from git it does not. :-( – erik Sep 10 '16 at 12:07
  • Does parallel -u make a difference? – Ole Tange Sep 11 '16 at 0:46
  • No, -u doesn’t make a difference. My temporary workaround is to use the ffmpeg version shipped with Fedora, which is ok for these audio codec conversions. But it would be nice to know what is going wrong and if it’s also the case within other distributions. – erik Sep 11 '16 at 12:29
  • Since you have a release that is working and a git version that is broken, you should be able to identify the git revision in which it broke. git bisect run is brilliant for that. By identifying the problematic change it can probably be determined whether this is an ffmpeg issue or a GNU parallel issue. – Ole Tange Sep 12 '16 at 10:37
  • I tested in a Mac OSX El Captain with parallel 20160922 and ffmpeg version 3.2, and I'm having this exact problem: the process continues forever and the first file is always missing., when trying to convert a bunch of flac files to mp3. – Somebody still uses you MS-DOS Oct 31 '16 at 3:07
1

Solution is —as suggested by @OleTange in a comment— to update to a newer version of parallel, i.e. GNU parallel 20161122. EVerything works again.

And it is better to protect the commands from shell interaction with single quotes, i.e.:

parallel --bar 'ffmpeg -i {} -map_metadata 0 {/.}.flac' ::: *

and

parallel --bar 'ffmpeg -i {} -vn -ar 44100 -ab 128k -map_metadata 0 {/.}.mp3' ::: $@
  • The quoting is only needed if you use shell interacting chars (which you do not in your example). If your quoting becomes too complex, consider writing a function instead: gnu.org/software/parallel/… – Ole Tange Jan 20 '17 at 8:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.