mmdtsdec writing to standard output

Discussion of advanced MakeMKV functionality, expert mode, conversion profiles
Post Reply
MI3Guy
Posts: 26
Joined: Tue Oct 25, 2011 8:57 pm

mmdtsdec writing to standard output

Post by MI3Guy »

Would it be possible to allow mmdtsdec to write to standard output instead of a file?

Using the following command I was able to pipe the audio directly into flac. (Channel map is due to the input being a 7.1 file.)

mmdtsdec -d dtsdecoderdll.dll dts_logo.dtshd /dev/stdout | flac --channel-map=none -8 - --ignore-chunk-sizes -o test-out2.flac

However, this causes mmdtsdec to fail with an error code due to being unable to seek to update the wav header. I also created a wav file normally using mmdtsdec and encoded it with flac. I decoded the two flac files and the results were identical.

Using /dev/stdin for the input file appears to work properly.

Is there any chance this could be implemented in such a way that mmdtsdec would not fail? It would also be nice if it was possible to use "-" to refer to stdin and stdout.
kevmitch
Posts: 72
Joined: Mon Mar 11, 2013 6:35 am

Re: mmdtsdec writing to standard output

Post by kevmitch »

Interesting trick. I hadn't thought of that. mikeadmin mentioned that mmdtsdec can talk to a tcp port (that's in fact how the on the fly flac conversion works from makemkv), but he hasn't said how it's used and it's defintiely not documented.
mike admin
Posts: 4065
Joined: Wed Nov 26, 2008 2:26 am
Contact:

Re: mmdtsdec writing to standard output

Post by mike admin »

WAV file is not streamable, as it requires file size to be present in header. mmdtsdec can write into its own streamable "wav-like" format, either to stdout/file or a tcp socket, but you would need to write an application to parse the data. If you know a good streamable PCM format, its supoort can be added to mmdtsdec.
MI3Guy
Posts: 26
Joined: Tue Oct 25, 2011 8:57 pm

Re: mmdtsdec writing to standard output

Post by MI3Guy »

While that's true, it is possible to break the standard a bit and write a zero for the size and use programs that will ignore it. If you are not interested in implementing this, I would appreciate it if you could give more details about the tcp-based protocol.
mike admin
Posts: 4065
Joined: Wed Nov 26, 2008 2:26 am
Contact:

Re: mmdtsdec writing to standard output

Post by mike admin »

MI3Guy wrote:While that's true, it is possible to break the standard a bit and write a zero for the size and use programs that will ignore it.
That's exactly what mmdstdec does. It writes incomplete wav header and all frames sequentially, and then tries to update header. When it fails, it quits with error, but all data are written correctly at that point, only header is incorrect.
MI3Guy wrote:If you are not interested in implementing this, I would appreciate it if you could give more details about the tcp-based protocol.
Are you planning to use it in your application? mmdtsdec is free, the only restriction is that you have to use it in a freeware (open or closed source) project.
MI3Guy
Posts: 26
Joined: Tue Oct 25, 2011 8:57 pm

Re: mmdtsdec writing to standard output

Post by MI3Guy »

Right. My idea was to add a switch to suppress the error.

I was planning on using this in an open source program that I am writing.

Either one of these would be appreciated.
Post Reply