ffmpegwasm / ffmpeg.wasm

FFmpeg for browser, powered by WebAssembly
https://ffmpegwasm.netlify.app
MIT License
14.34k stars 842 forks source link

TypeError [ERR_WORKER_PATH]: The worker script or module filename must be an absolute path or a relative path #225

Open hnguyen48206 opened 3 years ago

hnguyen48206 commented 3 years ago

Describe the bug Hi, I'm trying to implement a feature which is live transcoding a hls stream (h265) to another hls stream (h264) so the video can be played using html5 as we know that h265 is not supported on browsers. This in an Electron desktop app by the way.

However, when running this ffmpeg command: -i http://10.70.39.32:80/streams/60dd68f…/stream/60dd68f….m3u8 -vcodec libx264 -acodec copy -f hls -hls_list_size 3 -hls_wrap 5 playlist.m3u8

I encountered this error about worker could not find the necessary script.

image

To Reproduce Steps to reproduce the behavior:

My dev Enviroment:

 "devDependencies": {
    "electron": "^13.1.5",
    "electron-packager": "^13.0.1",
    "electron-winstaller": "^2.7.0"
  }

Steps to reproduce:

  1. Includes the script in header tag: <script async defer src="https://unpkg.com/@ffmpeg/ffmpeg@0.10.1/dist/ffmpeg.min.js"></script>
  2. Load ffmpeg in the body:
 <button class="waves-effect waves-light btn" onclick="loadPlayerHEVC()">Play</button>

            <video-js id="my_video_1" class="vjs-default-skin" controls preload="auto" width="640" height="268">
                <source src="playlist.m3u8" type="application/x-mpegURL">
            </video-js>

            <script src="https://unpkg.com/video.js/dist/video.js"></script>
            <script src="https://unpkg.com/@videojs/http-streaming/dist/videojs-http-streaming.js"></script>

            <script>
                var player = videojs('my_video_1');
            </script>

            <script>
                async function loadPlayerHEVC() {
                    var resource = 'http://10.70.39.32:80/streams/60dd68fdc88f570012526657/stream/60dd68fdc8....526657.m3u8'
                    const { createFFmpeg } = FFmpeg;
                    const ffmpeg = createFFmpeg({ log: true });
                    const { fetchFile } = FFmpeg;
                    await ffmpeg.load();
                    await ffmpeg.run('-i', resource, '-vcodec', 'libx264', '-acodec', 'copy', '-f' ,'hls', '-hls_list_size', '3', '-hls_wrap', '5', 'playlist.m3u8' );
                    // ffmpeg.exit(0);
                }
            </script>

Any help would be much appreciated.

hnguyen48206 commented 3 years ago

Hi, I have found out the root cause for this matter which lies in Electron confirguartion, not this js library itself. So please ignore my 1st post. However, since I do not want to open too many threads for questions so I just use this one for my next inquiry which is about the usage of a remote resource as the input for ffmpeg transcoding:

image

This does not happen for a specific url, I have tried a couple of different ones that I could find but still no luck. For example, this one: http://113.163.94.245/hls-live/livepkgr/_definst_/liveevent/thbt.m3u8

leedsjung commented 1 year ago

Hi, I have found out the root cause for this matter which lies in Electron confirguartion, not this js library itself. So please ignore my 1st post. However, since I do not want to open too many threads for questions so I just use this one for my next inquiry which is about the usage of a remote resource as the input for ffmpeg transcoding:

image

This does not happen for a specific url, I have tried a couple of different ones that I could find but still no luck. For example, this one: http://113.163.94.245/hls-live/livepkgr/_definst_/liveevent/thbt.m3u8

hi,brother,how did you fixed the [ERR_WORKER_PATH] problem ? I had the same problem, And it's been bothering me for a long time. can u help me ? I would appreciate it very much.