Closed mandaputtra closed 5 years ago
UPDATE : takeScreenshots()
works
works after restarting computer.
I have the same problem .. and restarting doesn't solved magically my problem :D any tip ? Fluent-ffmpeg converts the file and it seems correct, but it trigger the on('error') anyway... This happens with an mp4 with no audio
return new Promise((res, rej) => {
const start = new Date();
ffmpeg(filePath)
.inputOptions(["-hide_banner", "-y"])
.outputOptions(
"-vsync", "0",
"-preset", "veryfast",
"-g", "48",
"-sc_threshold", "0",
"-t", "45",
"-map", "0:0", "-map", "0:0",
"-s:v:0", "1280x720",
"-c:v:0", "h264",
"-b:v:0", "4200k",
"-c:a:0", "aac",
"-b:a:0", "128k",
"-s:v:1", "842x480",
"-c:v:1", "h264",
"-b:v:1", "2100k",
"-c:a:1", "aac",
"-b:a:1", "96k",
"-var_stream_map", 'v:0 v:1',
"-master_pl_name", "master.m3u8",
"-f", "hls",
"-hls_time", "6",
"-hls_list_size", "0",
"-hls_segment_filename", "./converted/" + fileName + "/v%v.chunk%d.ts"
)
.output(`./converted/${fileName}/v%v.m3u8`)
.on("progress", function (progress) {
console.log("Converting at: " + progress.currentFps + " FPS");
})
.on("end", function (err, stdout, stderr) {
console.log("Finished processing in :", new Date() - start);
res();
})
.on("error", function (err, a, b) {
console.error(err, a, b);
rej(err);
})
.run();
});
link to a file that causes the problem: https://external.r1-it.storage.cloud.it/B.mp4
additional output for the error:
Error: ffmpeg exited with code 3221225477:
at ChildProcess.<anonymous> (E:\Workspace\hls-transcoding\node_modules\fluent-ffmpeg\lib\processor.js:182:22)
at ChildProcess.emit (events.js:316:20)
at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12) Input #0, mov,mp4,m4a,3gp,3g2,mj2, from './B.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.29.100
Duration: 00:00:02.56, start: 0.160000, bitrate: 8835 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 950x540, 8831 kb/s, 12.50 fps, 12.50 tbr, 12800 tbn, 25 tbc (default)
Metadata:
handler_name : VideoHandler
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Stream #0:0 -> #0:1 (h264 (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[libx264 @ 0000024ccb26eb00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0000024ccb26eb00] profile High, level 3.1, 4:2:0, 8-bit
[libx264 @ 0000024ccb26eb00] 264 - core 157 r2935 545de2f - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=1 ref=1 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=2 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me
=1 trellis=0 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=18 lookahead_threads=5 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=1
keyint=48 keyint_min=4 scenecut=0 intra_refresh=0 rc_lookahead=10 rc=abr mbtree=1 bitrate=4200 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
[libx264 @ 0000024ccb271740] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 @ 0000024ccb271740] profile High, level 2.2, 4:2:0, 8-bit
[libx264 @ 0000024ccb271740] 264 - core 157 r2935 545de2f - H.264/MPEG-4 AVC codec - Copyleft 2003-2018 - http://www.videolan.org/x264.html - options: cabac=1 ref=1 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=2 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me
=1 trellis=0 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=15 lookahead_threads=3 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=1
keyint=48 keyint_min=4 scenecut=0 intra_refresh=0 rc_lookahead=10 rc=abr mbtree=1 bitrate=2100 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
[hls @ 0000024ccb1ad9c0] Opening './converted/test/v0.chunk0.ts' for writing
[hls @ 0000024ccb1ad9c0] Opening './converted/test/v1.chunk0.ts' for writing
Output #0, hls, to './converted/test/v%v.m3u8':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.24.101
Stream #0:0(und): Video: h264 (libx264), yuv420p(progressive), 1280x720, q=-1--1, 4200 kb/s, 12.50 fps, 90k tbn, 12.50 tbc (default)
Metadata:
handler_name : VideoHandler
encoder : Lavc58.42.102 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/4200000 buffer size: 0 vbv_delay: -1
Stream #0:1(und): Video: h264 (libx264), yuv420p, 842x480, q=-1--1, 2100 kb/s, 12.50 fps, 90k tbn, 12.50 tbc (default)
Metadata:
handler_name : VideoHandler
encoder : Lavc58.42.102 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/2100000 buffer size: 0 vbv_delay: -1
[hls @ 0000024ccb1ad9c0] Cannot use rename on non file protocol, this may lead to races and temporary partial files
[hls @ 0000024ccb1ad9c0] Opening './converted/test/v0.m3u8' for writing
[hls @ 0000024ccb1ad9c0] Opening './converted/test/v1.m3u8' for writing
[hls @ 0000024ccb1ad9c0] Opening './converted/test/master.m3u8' for writing
(node:1448) UnhandledPromiseRejectionWarning: Error: ffmpeg exited with code 3221225477:
at ChildProcess.<anonymous> (E:\Workspace\hls-transcoding\node_modules\fluent-ffmpeg\lib\processor.js:182:22)
at ChildProcess.emit (events.js:316:20)
at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
I think the problem is a bug for which codec ffmpeg should use. If including .videoCodec("libx264") it no longer crashes. But the output.png is not a png but mp4. The image codec should be png I think but you can't specify it with this library. I can't find any workaround to get this working.
According to the docs .output(screenshot.png) should work too but it's the same problem.
Edit: Hmm, maybe a windows bug. The same code works in Linux/Ubuntu
Version information
Code to reproduce
(note: if the problem only happens with some inputs, include a link to such an input file)
Expected results
Generating screenshoot from video
Observed results
Having error with this message :
Checklist