Why does using <(command) with mpv fail, but piping works?

0
2
Asked By CuriousCat93 On

I'm trying to conduct some listening tests by converting a FLAC file to opus at various bitrates. I can successfully run the command `opusenc --bitrate nnn song.flac - | mpv --no-audio-display -` without any issues. However, I thought using process substitution like this `mpv --no-audio-display <(opusenc --bitrate nnn song.flac -)` would have the same effect, but it fails. I receive error messages indicating that mpv cannot recognize the file format. Can someone help me understand what's going wrong here?

5 Answers

Answered By LinuxLover21 On

Unfortunately, a lot of programs don't really support process substitution properly. What happens is that with `<(...)`, bash creates a pipe and gives mpv a file descriptor to read from. If mpv treats it like a regular file instead of a stream, it can fail. It probably has the capability to read from stdin, but it doesn't recognize the FIFO from the substitution.

Answered By TechieTurtle47 On

mpv seems to try seeking when it opens a file. When you use process substitution, it ends up receiving a FIFO instead of a regular file, which could lead to those seeking issues. If it mistakenly thinks it can seek, but it can't, that's where the error comes from. When you pass a dash `-`, it knows to just read from stdin and not try to seek.

InquisitiveBird88 -

That makes a lot of sense! Sometimes programs don't handle those situations well.

Answered By AudioExplorer72 On

You might want to check how you're structuring the command. I think you need the dash `-` at the end of the mpv command, but it may not be necessary. Just a thought!

CuriousCat93 -

Thanks for the tip! But it seems like that isn't the main issue.

Answered By CodecWizard99 On

The two methods are fundamentally different. Using a dash to indicate stdin is telling mpv to expect input from the standard input, but with process substitution, it's making a named pipe that it might not interpret correctly. That's likely causing the discrepancy in behavior.

Answered By CleverCoder33 On

Wait, was the dash missing by design in your second command? That could definitely change how things work.

Related Questions

Online Audio Cleanup Tool

Extract Audio From Video File

Compress MP3 File

Online Audio Converter

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.