Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ffmpeg snags stdin which prevents while loops from continuing #69

Open
mattster98 opened this issue Feb 24, 2012 · 4 comments
Open

ffmpeg snags stdin which prevents while loops from continuing #69

mattster98 opened this issue Feb 24, 2012 · 4 comments

Comments

@mattster98
Copy link

I was trying to use mkvdts2ac3 in a while loop to process all my mkv's that have DTS tracks, and it would always stop after processing one file. I searched around a bit and the cause appears to be that ffmpeg does that "Press [q] to stop encoding" and that somehow breaks the while loop.

The fix, from here: http://ubuntuforums.org/archive/index.php/t-1335037.html
was to add < /dev/null to satisfy the stdin for ffmpeg. However, I can't make that work without eliminating the perl progress tracking for that step. It works great if I change that line to just run a basic ffmpeg command line instead.

Hopefully your bash-fu is stronger than mine and you can make this work, while still keeping the nifty progress tracking you've got.

Thanks for the awesome script!!

@choekstr
Copy link
Collaborator

Hmm. Are you just doing a:
For i in $(ls moviefiles) do loop?

Let me know how you are calling it and any options you use so I can recreate and see if I can come up with an alternate solution.

@mattster98
Copy link
Author

It's a little more complicated, unfortunately.

find . | grep mkv$ | while read lines; do if mkvinfo "$lines" | grep A_DTS;
then echo Starting $lines; mkvdts2ac3 -n -m "$lines"; echo $lines is
done;fi; done

Not pretty, but gets the job done. The "echo" statements were mostly for
troubleshooting.. not required. The mkvinfo is just to prevent your script
from bombing over and over needlessly. -n is the only option I really
need. I added -m because of a reference to being called from cron or
something which I thought might help.

--Matt

On Fri, Feb 24, 2012 at 4:13 PM, Chris Hoekstra <
reply@reply.github.com

wrote:

Hmm. Are you just doing a:
For i in $(ls moviefiles) do loop?

Let me know how you are calling it and any options you use so I can
recreate and see if I can come up with an alternate solution.


Reply to this email directly or view it on GitHub:
#69 (comment)

@JakeWharton
Copy link
Owner

Just an FYI, you shouldn't need to grep for DTS. The script will ignore anything without a DTS track in it and anything that looks like its already had the conversion done.

@jonuwz
Copy link

jonuwz commented Sep 13, 2017

last answer here : https://stackoverflow.com/questions/21634088/execute-ffmpeg-command-in-a-loop

passing -nostdin to ffmpeg is the right thing to do . Since we're masking the interactive dialog anyway, this should be in the default command

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants