question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't reuse ffmpeg

See original GitHub issue

Describe the bug GIVEN I load ffmpeg AND I run any command AND I run another command THEN an error is thrown

[info] run ffmpeg command: -L
Uncaught (in promise) 
{
    "name": "ExitStatus",
    "message": "Program terminated with exit(0)",
    "status": 0
}

To Reproduce

const fs = require('fs');
const { createFFmpeg, fetchFile } = require('@ffmpeg/ffmpeg');

const ffmpeg = createFFmpeg({ log: true });

(async () => {
  await ffmpeg.load();
  await ffmpeg.run('-L');
  await ffmpeg.run('-L');
})();

Expected behavior It should run both commands

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:3
  • Comments:7

github_iconTop GitHub Comments

3reactions
0x-jjcommented, Mar 24, 2022

I’m experiencing similar issues.

0reactions
usr-eincommented, Sep 6, 2022

I use both the single-threaded and the multi-threaded version in my app, and dynamically switch between the two when available, and I noticed that, when using the multithreaded one (proxy_main), I can successfully run two commands await ffmpeg.run.

However, when using the single-threaded version, the first command succeeds, but the second one just hangs forever. The last message from FFMPEG’s logging is

...
[ffout] FFMPEG_END
[info] run ffmpeg command: -framerate ...

and then eternal hanging.

My solution was to: read the files from the first command into memory using ffmpeg.FS("readFile", then, await ffmpeg.exit(), then await ffmpeg.load(), then copy back the file from the previous run, plus all my other required files, and then run my second command.

This did the trick in single-threaded mode, but it’s a shame I can’t resuse the files I wrote the first time around.

Tested on ffmpeg-core version 11.4, compiled on commit 1f3461d.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ffmpeg Documentation
If the selected pixel format can not be selected, ffmpeg will print a warning and ... Re-use existing streams when a PMT's version...
Read more >
FFmpeg and how to use it wrong - VideoBlerg - WordPress.com
It is not uncommon for FFmpeg to duplicate the first frame. ... Never reuse your first pass analysis when creating Adaptive Bitrate (ABR) ......
Read more >
When recording MP4 using ffmpeg suddenly power off
The main cause of MP4 file damage is due to header or trailer not written properly on the file , then , whole...
Read more >
A quick guide to using FFmpeg to convert media files
FFmpeg is a great tool for quickly changing an AV file's format or quality ... frame rates, and container metadata; and can't support...
Read more >
FFmpeg won't encode at Main10@L5.1 - Super User
ffmpeg -y -r 23.97602 -i %6d.png -vcodec libx265 -profile:v main10 -x265-params ... analysis-reuse-level=0 / analysis-save-reuse-level=0 ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found