ffmpeg version: 5.0-essentials_build-www.gyan.dev Copyright (c) 2000-2022 the FFmpeg developers built with gcc 11.2.0 (Rev5, Built by MSYS2 project)
OS: Windows
Code to reproduce
stream_video_twitch: (path_twitch, rtmp_server_url_twitch, callback) => {
return new Promise((resolve, reject) => {
var stream_twitch = fs.createReadStream(path_twitch); // create a read-stream from the file path
var live = new ffmpeg({ // create a ffmpeg instance from the read-stream
source: stream_twitch // pipe the read-stream to the ffmpeg instance
})
.addOutputOption('-vcodec libx264')
.addOutputOption('-acodec aac')
.addInputOption(`-i ${path_twitch}`)
.addOutputOption('-f flv') // set the output format to flv
.addInputOption('-thread_queue_size 1024')
.addOutputOption('-ab 128k')
.addOutputOption('-vb 800k')
.addOutputOption('-s 720x360')
.addOutputOption('-r 30')
.on('error', function(err, stdout, stderr) { // handle encoding errors here
console.log('ffmpeg output for twitch:\n' + stdout);
console.log('ffmpeg stderr for twitch:\n' + stderr);
// console.log(err, 'err twitch');
// reject(err);
//callback({ status: 400, message: "twitch error" + err, data: null }) // if an error occurs, log it to the console
})
.on('end', function() { // handle encoding finished here
resolve(true);
callback({
status: 200,
message: "Successfully streamed to twitch",
}
);
})
.save(rtmp_server_url_twitch); // save the output to a file
});
},
Expected results
The expected result is to stream the video file to twitch through the rtmp url which it actually streams.
Observed results
The Observed result is that the vodeo streams to twitch but i get this error at the end which means ffmpeg did not work please whats wrong.
Fluent FFMPEG stderr
ffmpeg output for twitch:
ffmpeg stderr for twitch:
ffmpeg version N-60837-ge81242bb13-static https://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2022 the FFmpeg developers
built with gcc 8 (Debian 8.3.0-6)
configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg
libavutil 57. 22.100 / 57. 22.100
libavcodec 59. 21.103 / 59. 21.103
libavformat 59. 17.102 / 59. 17.102
libavdevice 59. 5.100 / 59. 5.100
libavfilter 8. 27.100 / 8. 27.100
libswscale 6. 5.100 / 6. 5.100
libswresample 4. 4.100 / 4. 4.100
libpostproc 56. 4.100 / 56. 4.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/app/routes/video/../../uploads/Tfqh0Wpm5s.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
creation_time : 2021-11-16T15:45:52.000000Z
Duration: 00:14:30.61, start: 0.000000, bitrate: 320 kb/s
Stream #0:00x1: Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], 188 kb/s, 30 fps, 30 tbr, 15360 tbn (default)
Metadata:
creation_time : 2021-11-16T15:45:52.000000Z
handler_name : ISO Media file produced by Google Inc. Created on: 11/16/2021.
vendor_id : [0][0][0][0]
Stream #0:10x2: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
creation_time : 2021-11-16T15:45:52.000000Z
handler_name : ISO Media file produced by Google Inc. Created on: 11/16/2021.
vendor_id : [0][0][0][0]
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'pipe:0':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
creation_time : 2021-11-16T15:45:52.000000Z
Duration: 00:14:30.61, start: 0.000000, bitrate: N/A
Stream #1:00x1: Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], 188 kb/s, 30 fps, 30 tbr, 15360 tbn (default)
Metadata:
creation_time : 2021-11-16T15:45:52.000000Z
handler_name : ISO Media file produced by Google Inc. Created on: 11/16/2021.
vendor_id : [0][0][0][0]
Stream #1:10x2: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
creation_time : 2021-11-16T15:45:52.000000Z
handler_name : ISO Media file produced by Google Inc. Created on: 11/16/2021.
vendor_id : [0][0][0][0]
rtmp://sfo.contribute.live-video.net/app/live_639382179_XZy5EtYfTOvJAV0S9Tq0dDrrLAKmgS: Input/output error
Version information
Code to reproduce
Expected results
The expected result is to stream the video file to twitch through the rtmp url which it actually streams.
Observed results
The Observed result is that the vodeo streams to twitch but i get this error at the end which means ffmpeg did not work please whats wrong.
Fluent FFMPEG stderr
ffmpeg output for twitch:
ffmpeg stderr for twitch: ffmpeg version N-60837-ge81242bb13-static https://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2022 the FFmpeg developers built with gcc 8 (Debian 8.3.0-6) configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gmp --enable-libgme --enable-gray --enable-libaom --enable-libfribidi --enable-libass --enable-libvmaf --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libdav1d --enable-libxvid --enable-libzvbi --enable-libzimg libavutil 57. 22.100 / 57. 22.100 libavcodec 59. 21.103 / 59. 21.103 libavformat 59. 17.102 / 59. 17.102 libavdevice 59. 5.100 / 59. 5.100 libavfilter 8. 27.100 / 8. 27.100 libswscale 6. 5.100 / 6. 5.100 libswresample 4. 4.100 / 4. 4.100 libpostproc 56. 4.100 / 56. 4.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/app/routes/video/../../uploads/Tfqh0Wpm5s.mp4': Metadata: major_brand : mp42 minor_version : 0 compatible_brands: isommp42 creation_time : 2021-11-16T15:45:52.000000Z Duration: 00:14:30.61, start: 0.000000, bitrate: 320 kb/s Stream #0:00x1: Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], 188 kb/s, 30 fps, 30 tbr, 15360 tbn (default) Metadata: creation_time : 2021-11-16T15:45:52.000000Z handler_name : ISO Media file produced by Google Inc. Created on: 11/16/2021. vendor_id : [0][0][0][0] Stream #0:10x2: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default) Metadata: creation_time : 2021-11-16T15:45:52.000000Z handler_name : ISO Media file produced by Google Inc. Created on: 11/16/2021. vendor_id : [0][0][0][0] Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'pipe:0': Metadata: major_brand : mp42 minor_version : 0 compatible_brands: isommp42 creation_time : 2021-11-16T15:45:52.000000Z Duration: 00:14:30.61, start: 0.000000, bitrate: N/A Stream #1:00x1: Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1280x720 [SAR 1:1 DAR 16:9], 188 kb/s, 30 fps, 30 tbr, 15360 tbn (default) Metadata: creation_time : 2021-11-16T15:45:52.000000Z handler_name : ISO Media file produced by Google Inc. Created on: 11/16/2021. vendor_id : [0][0][0][0] Stream #1:10x2: Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default) Metadata: creation_time : 2021-11-16T15:45:52.000000Z handler_name : ISO Media file produced by Google Inc. Created on: 11/16/2021. vendor_id : [0][0][0][0] rtmp://sfo.contribute.live-video.net/app/live_639382179_XZy5EtYfTOvJAV0S9Tq0dDrrLAKmgS: Input/output error