Mkvextract to stdout

I’d like to change from ffmpeg to mkvextract in this command:

ffmpeg -i $MKVFILE -c:v copy -bsf:v hevc_mp4toannexb -f hevc - | dovi_tool demux -

My problem is that it seems there is no way to do this stdout / piping with mkvextract. Is this true? Are there any workarounds?

No, there aren’t. mkvextract cannot extract tracks to standard output as a lot of formats require seeking in order to fix up header values after the bulk of the data has been written. Therefore mkvextract simply requires a seekable target for all track extraction, even for formats that can technically be written without seeking.

mkvextract can write chapters & tags to standard output.

1 Like

Thanks. At the end I ended up not using it, as I needed to do read it twice, at which point there was no advantage.

Here is a snippet where I would have used it, it’s for DoVi P7 → P8 conversion, it might come in handy for some.

mkvextract "$1" tracks 0:video.hevc

# check if BL/EL are in sync
dovi_tool demux video.hevc --el-only
dovi_tool -m 0 extract-rpu video.hevc -o BL_RPU.bin
dovi_tool -m 0 extract-rpu EL.hevc -o EL_RPU.bin
rm EL.hevc

if cmp -s BL_RPU.bin EL_RPU.bin; then
  echo "BL/EL are in sync"
  rm BL_RPU.bin EL_RPU.bin
  echo "BL/EL are not in sync"
  rm BL_RPU.bin EL_RPU.bin
  exit 1

dovi_tool -m 2 convert --discard video.hevc -o P8.hevc
rm video.hevc

mkvmerge --output "$1-P8.mkv" P8.hevc --no-video "$1"
rm P8.hevc

Is the mkvextract/mkvmerge usage correct in the above snippet?

Yes, they look fine.