ffmpeg.js
ffmpeg.js copied to clipboard
Update build instructions (fastcomp fix)
I built a custom FFMPEG following the README instructions, adding the filter setpts
to the Makefile. I managed to build successfully, and I managed to create a MP4 video with only MP3 audio.
I'm using ffmpeg-worker-mp4.js
.
As soon as I try to add an input image, the program exits with code 1, with not much information. Here's the console log (scriptfinal.js is the file where I handle all the FFmpeg-related stuff).
It looks like it crashes in the middle of decoding the image.
ffmpeg version n4.2.2 Copyright (c) 2000-2019 the FFmpeg developers
scriptfinal.js:135 built with emcc (Emscripten gcc/clang-like replacement) 1.39.13
scriptfinal.js:135 configuration: --cc=emcc --ranlib=emranlib --enable-cross-compile --target-os=none --arch=x86 --disable-runtime-cpudetect --disable-asm --disable-fast-unaligned --disable-pthreads --disable-w32threads --disable-os2threads --disable-debug --disable-stripping --disable-safe-bitstream-reader --disable-all --enable-ffmpeg --enable-avcodec --enable-avformat --enable-avfilter --enable-swresample --enable-swscale --disable-network --disable-d3d11va --disable-dxva2 --disable-vaapi --disable-vdpau --enable-decoder=vp8 --enable-decoder=h264 --enable-decoder=vorbis --enable-decoder=opus --enable-decoder=mp3 --enable-decoder=aac --enable-decoder=pcm_s16le --enable-decoder=mjpeg --enable-decoder=png --enable-demuxer=matroska --enable-demuxer=ogg --enable-demuxer=mov --enable-demuxer=mp3 --enable-demuxer=wav --enable-demuxer=image2 --enable-demuxer=concat --enable-protocol=file --enable-filter=aresample --enable-filter=scale --enable-filter=crop --enable-filter=overlay --enable-filter=hstack --enable-filter=vstack --enable-filter=setpts --disable-bzlib --disable-iconv --disable-libxcb --disable-lzma --disable-sdl2 --disable-securetransport --disable-xlib --enable-zlib --enable-encoder=libx264 --enable-encoder=libmp3lame --enable-encoder=aac --enable-muxer=mp4 --enable-muxer=mp3 --enable-muxer=null --enable-gpl --enable-libmp3lame --enable-libx264 --extra-cflags='-s USE_ZLIB=1 -I../lame/dist/include' --extra-ldflags=-L../lame/dist/lib
scriptfinal.js:135 libavutil 56. 31.100 / 56. 31.100
scriptfinal.js:135 libavcodec 58. 54.100 / 58. 54.100
scriptfinal.js:135 libavformat 58. 29.100 / 58. 29.100
scriptfinal.js:135 libavfilter 7. 57.100 / 7. 57.100
scriptfinal.js:135 libswscale 5. 5.100 / 5. 5.100
scriptfinal.js:135 libswresample 3. 5.100 / 3. 5.100
scriptfinal.js:135 Splitting the commandline.
scriptfinal.js:135 Reading option '-i' ... matched as input url with argument 'audio.mp3'.
scriptfinal.js:135 Reading option '-vcodec' ... matched as option 'vcodec' (force video codec ('copy' to copy stream)) with argument 'png'.
scriptfinal.js:135 Reading option '-i' ... matched as input url with argument 'img0.png'.
scriptfinal.js:135 Reading option '-vcodec' ... matched as option 'vcodec' (force video codec ('copy' to copy stream)) with argument 'png'.
scriptfinal.js:135 Reading option '-i' ... matched as input url with argument 'img1.png'.
scriptfinal.js:135 Reading option '-vcodec' ... matched as option 'vcodec' (force video codec ('copy' to copy stream)) with argument 'png'.
scriptfinal.js:135 Reading option '-i' ... matched as input url with argument 'img2.png'.
scriptfinal.js:135 Reading option '-vcodec' ... matched as option 'vcodec' (force video codec ('copy' to copy stream)) with argument 'png'.
scriptfinal.js:135 Reading option '-i' ... matched as input url with argument 'img3.png'.
scriptfinal.js:135 Reading option '-vcodec' ... matched as option 'vcodec' (force video codec ('copy' to copy stream)) with argument 'png'.
scriptfinal.js:135 Reading option '-i' ... matched as input url with argument 'img4.png'.
scriptfinal.js:135 Reading option '-vcodec' ... matched as option 'vcodec' (force video codec ('copy' to copy stream)) with argument 'png'.
scriptfinal.js:135 Reading option '-i' ... matched as input url with argument 'img5.png'.
scriptfinal.js:135 Reading option '-vcodec' ... matched as option 'vcodec' (force video codec ('copy' to copy stream)) with argument 'mjpeg'.
scriptfinal.js:135 Reading option '-i' ... matched as input url with argument 'img6.jpeg'.
scriptfinal.js:135 Reading option '-vcodec' ... matched as option 'vcodec' (force video codec ('copy' to copy stream)) with argument 'mjpeg'.
scriptfinal.js:135 Reading option '-i' ... matched as input url with argument 'img7.jpg'.
scriptfinal.js:135 Reading option '-vcodec' ... matched as option 'vcodec' (force video codec ('copy' to copy stream)) with argument 'mjpeg'.
scriptfinal.js:135 Reading option '-i' ... matched as input url with argument 'img8.jpg'.
scriptfinal.js:135 Reading option '-vcodec' ... matched as option 'vcodec' (force video codec ('copy' to copy stream)) with argument 'mjpeg'.
scriptfinal.js:135 Reading option '-i' ... matched as input url with argument 'img9.jpg'.
scriptfinal.js:135 Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'trace'.
scriptfinal.js:135 Reading option '-c:v' ... matched as option 'c' (codec name) with argument 'libx264'.
scriptfinal.js:135 Reading option '-t' ... matched as option 't' (record or transcode "duration" seconds of audio/video) with argument '15'.
scriptfinal.js:135 Reading option '-pix_fmt' ... matched as option 'pix_fmt' (set pixel format) with argument 'yuv420p'.
scriptfinal.js:135 Reading option 'out.mp4' ... matched as output url.
scriptfinal.js:135 Finished splitting the commandline.
scriptfinal.js:135 Parsing a group of options: global .
scriptfinal.js:135 Applying option loglevel (set logging level) with argument trace.
scriptfinal.js:135 Successfully parsed a group of options.
scriptfinal.js:135 Parsing a group of options: input url audio.mp3.
scriptfinal.js:135 Successfully parsed a group of options.
scriptfinal.js:135 Opening an input file: audio.mp3.
scriptfinal.js:135 [NULL @ 0x739470] Opening 'audio.mp3' for reading
scriptfinal.js:135 [file @ 0x739b20] Setting default whitelist 'file,crypto'
scriptfinal.js:135 Probing mp3 score:1 size:1956
scriptfinal.js:135 Probing mp3 score:25 size:4004
scriptfinal.js:135 Probing mp3 score:51 size:8100
scriptfinal.js:135 [mp3 @ 0x739470] Format mp3 probed with size=8192 and score=51
scriptfinal.js:135 id3v2 ver:3 flags:00 len:82
scriptfinal.js:135 [mp3 @ 0x739470] pad 576 0
scriptfinal.js:135 [mp3 @ 0x739470] Skipping 0 bytes of junk at 668.
scriptfinal.js:135 [mp3 @ 0x739470] Before avformat_find_stream_info() pos: 668 bytes read:32768 seeks:0 nb_streams:1
scriptfinal.js:135 [mp3 @ 0x742560] Warning: not compiled with thread support, using thread emulation
scriptfinal.js:135 [mp3 @ 0x739470] demuxer injecting skip 1105 / discard 0
scriptfinal.js:135 [mp3 @ 0x742560] skip 1105 / discard 0 samples due to side data
scriptfinal.js:135 [mp3 @ 0x742560] skip 1105/1152 samples
scriptfinal.js:135 [mp3 @ 0x739470] All info found
scriptfinal.js:135 [mp3 @ 0x739470] stream 0: start_time: 0.023 duration: 292.800
scriptfinal.js:135 [mp3 @ 0x739470] format: start_time: 0.023 duration: 292.800 bitrate=192 kb/s
scriptfinal.js:135 [mp3 @ 0x739470] After avformat_find_stream_info() pos: 30364 bytes read:32768 seeks:0 frames:50
scriptfinal.js:135 Input #0, mp3, from 'audio.mp3':
scriptfinal.js:135 Metadata:
scriptfinal.js:135 title : ABBA - Gimme, Gimme, Gimme! (video)
scriptfinal.js:135 encoder : Lavf56.40.101
scriptfinal.js:135 Duration: 00:04:52.80, start: 0.023021, bitrate: 192 kb/s
scriptfinal.js:135 Stream #0:0, 50, 1/14112000: Audio: mp3, 48000 Hz, stereo, s16p, 192 kb/s
scriptfinal.js:135 Metadata:
scriptfinal.js:135 encoder : Lavc56.60
scriptfinal.js:135 Successfully opened the file.
scriptfinal.js:135 Parsing a group of options: input url img0.png.
scriptfinal.js:135 Applying option vcodec (force video codec ('copy' to copy stream)) with argument png.
scriptfinal.js:135 Successfully parsed a group of options.
scriptfinal.js:135 Opening an input file: img0.png.
scriptfinal.js:135 [NULL @ 0x742b10] Opening 'img0.png' for reading
scriptfinal.js:135 [file @ 0x743358] Setting default whitelist 'file,crypto'
scriptfinal.js:135 Probing image2 score:50 size:2048
scriptfinal.js:135 [image2 @ 0x742b10] Format image2 probed with size=2048 and score=50
scriptfinal.js:135 [image2 @ 0x742b10] Before avformat_find_stream_info() pos: 0 bytes read:32768 seeks:0 nb_streams:1
scriptfinal.js:135 [png @ 0x7440c0] Warning: not compiled with thread support, using thread emulation
scriptfinal.js:135 [image2 @ 0x742b10] stream 0: start_time: 0.000 duration: 0.040
scriptfinal.js:135 [image2 @ 0x742b10] format: start_time: 0.000 duration: 0.040 bitrate=25047 kb/s
scriptfinal.js:135 [image2 @ 0x742b10] After avformat_find_stream_info() pos: 125239 bytes read:125239 seeks:0 frames:1
scriptfinal.js:135 Input #1, image2, from 'img0.png':
scriptfinal.js:135 Duration: 00:00:00.04, start: 0.000000, bitrate: 25047 kb/s
scriptfinal.js:135 exception thrown: TypeError: ta is not a function,TypeError: ta is not a function
at Pta (http://localhost:8887/ffmpeg-worker-mp4.js:123:21454)
at Zu (http://localhost:8887/ffmpeg-worker-mp4.js:31:244690)
at cq (http://localhost:8887/ffmpeg-worker-mp4.js:47:272977)
at Array.$M (http://localhost:8887/ffmpeg-worker-mp4.js:27:2115470)
at Wu (http://localhost:8887/ffmpeg-worker-mp4.js:55:101518)
at o_ (http://localhost:8887/ffmpeg-worker-mp4.js:79:146961)
at kpa (http://localhost:8887/ffmpeg-worker-mp4.js:55:75222)
at b (http://localhost:8887/ffmpeg-worker-mp4.js:14:336)
at Ua (http://localhost:8887/ffmpeg-worker-mp4.js:15:358)
at cb (http://localhost:8887/ffmpeg-worker-mp4.js:233:71)
scriptfinal.js:135 Stream #1:0, 1, 1/25: Video: png, 1 reference frame, rgba(pc), 738x720, 0/1,
ffmpeg-worker-mp4.js:16 Uncaught Ta {name: "ExitStatus", message: "Program terminated with exit(1)", status: 1}
I added the logs generated by -loglevel trace
Try with git revert 73288393805b91f481e1ac5dc123825947bfd1bf
I've added changes to use fastcomp backend but haven't updated instructions yet.
Will try that. On another note, I'm unfamiliar with the build workflow with Make. Is there any way to clean a build, or rebuild after changing the makefile? If I remove the js files and rerun make
, that certainly doesn't work.
Reverting to that commit did the trick.
Is there any way to clean a build, or rebuild after changing the makefile?
make clean
Same issue +1.
By the way, after I reverted the commit, the script I build will never trigger "done" event, only trigger "exit".
I found the reason, It trigger an "exit" event with data "0" before "done" event... But I terminal the worker after meet "exit" event.