It's been a while, but finally I made a LEGAL solution for this.
I created a WebAssembly Decoder with FFmpeg(under GPLv2 license) & Emscripten for my solution(which decodes h264 or h265 bitstream to yuv420 ArrayBuffer).
Our company bought a license for H265(the most important part, browser does not support H265 because of license issue).
Also, my client decided to watch video on modern browser which supports VideoTrackGenerator(MediaStreamGenerator for Chrome & Edge).
So I decoded NALus on the browser and write stream through writer of track(VideoTrackGenerator's track for safari and MediaStreamGenerator itself for Chrom & Edge).