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

Support file syscall which are used by mkvmerge command. #2902

Open
milad2golnia opened this issue Nov 7, 2024 · 2 comments
Open

Support file syscall which are used by mkvmerge command. #2902

milad2golnia opened this issue Nov 7, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@milad2golnia
Copy link

This issue is originated from this discussion

Based on the error, it might be that mkvmerge is calling a file syscall we don't support yet. You can open another issue for that and we that's more feasible then the original issue.

Currently we can not debug programs which contains mkvmerge command because it seems mirrord doesn't support some of its underlying file syscalls.

More information

This is just a reminder from mentioned issue.

Target code:

 async merge(
    framerate: number,
    sourcePath: string,
    destinationPath: string,
  ): Promise<string> {
    // Two following lines, convert relative path to absolute path:
    sourcePath = sourcePath.replace(/^\.\//, '/app/')
    destinationPath = destinationPath.replace(/^\.\//, '/app/')

    if (framerate <= 0) throw new Error(`Received ${framerate} as framerate.`)
    this.logger.verbose(
      `Merging matroska multimedia with: mkvmerge --default-duration 0:${framerate}fps ${sourcePath} -o ${destinationPath}`,
    )

    return new Promise((resolve, reject) => {
      const child = spawn('mkvmerge', [
        '--default-duration',
        `0:${framerate}fps`,
        sourcePath,
        '-o',
        destinationPath,
      ])

      child.stderr.on('data', (chunk) => {
        this.logger.warn(chunk)
      })
      child.on('error', (err) => {
        this.logger.error(
          `Merging matroska failed: ${err.name} | ${err.message}`,
          err.stack,
        )
        reject(err)
      })
      child.on('close', (code, signal) => {
        if (code !== 0) {
          this.logger.error(
            `Merging matroska video faild with code ${code} and signal ${signal}`,
          )
          reject(code)
        } else {
          return resolve(destinationPath)
        }
      })
    })
  }

Here is output of debugging with mirrord:

VERBOSE [Matroska] Merging matroska multimedia with: mkvmerge --default-duration 0:25fps /app/media/da86527f-c75f-4e52-a98a-59186cbe0ba4/add17fb6-b571-434b-aaf8-7f1d45cc830f-1730724272420/recording-merged.webm -o /app/media/da86527f-c75f-4e52-a98a-59186cbe0ba4/add17fb6-b571-434b-aaf8-7f1d45cc830f-1730724272420/add17fb6-b571-434b-aaf8-7f1d45cc830f-fixed-framerate.webm
[Nest] 36046  - 11/04/2024, 9:41:24 PM    WARN [Matroska] terminate called after throwing an instance of 'boost::filesystem::filesystem_error'
  what():  boost::filesystem::status: Function not implemented [system:38]: "/app/media/da86527f-c75f-4e52-a98a-59186cbe0ba4/add17fb6-b571-434b-aaf8-7f1d45cc830f-1730724272420"
@milad2golnia milad2golnia added the enhancement New feature or request label Nov 7, 2024
Copy link

linear bot commented Nov 7, 2024

Copy link
Member

aviramha commented Nov 7, 2024

Thanks for the elaborate report!

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

No branches or pull requests

2 participants