
Recherche avancée
Autres articles (42)
-
Keeping control of your media in your hands
13 avril 2011, parThe vocabulary used on this site and around MediaSPIP in general, aims to avoid reference to Web 2.0 and the companies that profit from media-sharing.
While using MediaSPIP, you are invited to avoid using words like "Brand", "Cloud" and "Market".
MediaSPIP is designed to facilitate the sharing of creative media online, while allowing authors to retain complete control of their work.
MediaSPIP aims to be accessible to as many people as possible and development is based on expanding the (...) -
Publier sur MédiaSpip
13 juin 2013Puis-je poster des contenus à partir d’une tablette Ipad ?
Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir -
Soumettre améliorations et plugins supplémentaires
10 avril 2011Si vous avez développé une nouvelle extension permettant d’ajouter une ou plusieurs fonctionnalités utiles à MediaSPIP, faites le nous savoir et son intégration dans la distribution officielle sera envisagée.
Vous pouvez utiliser la liste de discussion de développement afin de le faire savoir ou demander de l’aide quant à la réalisation de ce plugin. MediaSPIP étant basé sur SPIP, il est également possible d’utiliser le liste de discussion SPIP-zone de SPIP pour (...)
Sur d’autres sites (8745)
-
ffmpeg overlay png on video has color issue
9 janvier 2023, par RichardIm trying a simple overlay command to put a logo on a black video, but find the color a little different in output, the original RGB value of green part of the logo is (0,220,90), but changed to (0,191,88) in output. Looks like the color gets mixed with the black background, any ideas ?


original logo rgb :




rgb after logo overlayed on video :




the command to overlay :


ffmpeg -i video.mp4 -i logo.png -filter_complex "[1:v]format=rgba[s],[0:v][s]overlay=240:1275:format=auto" output.mp4





▶ ffmpeg -i logo.png 
ffmpeg version 4.4-static https://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2021 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 56. 70.100 / 56. 70.100
 libavcodec 58.134.100 / 58.134.100
 libavformat 58. 76.100 / 58. 76.100
 libavdevice 58. 13.100 / 58. 13.100
 libavfilter 7.110.100 / 7.110.100
 libswscale 5. 9.100 / 5. 9.100
 libswresample 3. 9.100 / 3. 9.100
 libpostproc 55. 9.100 / 55. 9.100 
Input #0, png_pipe, from 'logo.png':
 Duration: N/A, bitrate: N/A
 Stream #0:0: Video: png, rgba(pc), 601x81 [SAR 2834:2834 DAR 601:81], 25 fps, 25 tbr, 25 tbn, 25 tbc

▶ ffmpeg -i video.mp4 
ffmpeg version 4.4-static https://johnvansickle.com/ffmpeg/ Copyright (c) 2000-2021 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 56. 70.100 / 56. 70.100
 libavcodec 58.134.100 / 58.134.100
 libavformat 58. 76.100 / 58. 76.100
 libavdevice 58. 13.100 / 58. 13.100
 libavfilter 7.110.100 / 7.110.100
 libswscale 5. 9.100 / 5. 9.100
 libswresample 3. 9.100 / 3. 9.100
 libpostproc 55. 9.100 / 55. 9.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video.mp4':
 Metadata:
 major_brand : isom
 minor_version : 512
 compatible_brands: isomiso2avc1mp41
 encoder : Lavf58.76.100
 Duration: 00:00:02.00, start: 0.000000, bitrate: 24 kb/s
 Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1080x1920, 18 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
 Metadata:
 handler_name : VideoHandler
 vendor_id : [0][0][0][0]



-
Extracting multiple video streams using FFmpeg
11 avril 2023, par Ashutosh SinglaI have a video file that contains 4 streams, 3 videos streams and one steam for metadata.


Stream Info :


Input #0, matroska,webm, from 'output_master.mkv':
Metadata:
title : Azure Kinect
encoder : libmatroska-1.4.9
creation_time : 2021-05-20T12:11:15.000000Z
K4A_DEPTH_DELAY_NS: 0
K4A_WIRED_SYNC_MODE: MASTER
K4A_COLOR_FIRMWARE_VERSION: 1.6.110
K4A_DEPTH_FIRMWARE_VERSION: 1.6.79
K4A_DEVICE_SERIAL_NUMBER: 000123102712
K4A_START_OFFSET_NS: 298800000
Duration: 00:00:40.03, start: 0.000000, bitrate: 480934 kb/s

Stream #0:0(eng): Video: mjpeg (Baseline) (MJPG / 0x47504A4D), yuvj422p(pc, bt470bg/unknown/unknown), 2048x1536, SAR 1:1 DAR 4:3, 30 fps, 30 tbr, 1000k tbn (default)
Metadata:
 title : COLOR
 K4A_COLOR_TRACK : 14499183330009048
 K4A_COLOR_MODE : MJPG_1536P
Stream #0:1(eng): Video: rawvideo (b16g / 0x67363162), gray16be, 640x576, SAR 1:1 DAR 10:9, 30 fps, 30 tbr, 1000k tbn (default)
Metadata:
 title : DEPTH
 K4A_DEPTH_TRACK : 429408169412322196
 K4A_DEPTH_MODE : NFOV_UNBINNED
Stream #0:2(eng): Video: rawvideo (b16g / 0x67363162), gray16be, 640x576, SAR 1:1 DAR 10:9, 30 fps, 30 tbr, 1000k tbn (default)
Metadata:
 title : IR
 K4A_IR_TRACK : 194324406376800992
 K4A_IR_MODE : ACTIVE
Stream #0:3: Attachment: none
Metadata:
 filename : calibration.json
 mimetype : application/octet-stream
 K4A_CALIBRATION_FILE: calibration.json



I am using this command to extract the first stream :


ffmpeg -i output_master.mkv -c copy -map 0:v:0 out_1.mkv



For the other two streams, I am using this command :


ffmpeg -i output_master.mkv -c:v ffv1 -pix_fmt gray16be -allow_raw_vfw 1 -map 0:v:1 out_2.mkv
ffmpeg -i output_master.mkv -c:v ffv1 -pix_fmt gray16be -allow_raw_vfw 1 -map 0:v:2 out_3.mkv



I do not know if I am using the right commands to extracting the video streams.


-
How to overlay two mp3 audio files with different bitrates using fluent-ffmpeg
7 janvier 2023, par Alex P MnzI am trying to overlay one mp3 file (a speech track, the file name for which is passed into the below function) on top of another (a background music track, the url of which is passed into the function), so that they both play simultaneously, using NodeJS and fluent-ffmpeg.


What happens when I call the function is that I get an output file which 1) only plays the background audio track, and 2) upon opening the output track, the time seeker skips straight to where the end of the first audio track would have been (around 1 minute 30 seconds).


I'd like to in the first instance have them play at the same time as each other in the output file, without this skipping ahead effect (even if I drag the slider back to within the first 1 minute 30, it just jumps straight back to 1 minute 31 seconds - as if somehow there was no data in that first minute and a half).


In the second instance, I'd also like to have the background audio track loop until the first track finishes, so any help with that as part of an answer would be very much appreciated. But the immediate problem is just getting the two audios to actually play simultaneously starting from 0 seconds.


I have tried the below to get to this point :


const fs = require('fs');
const ffmpegPath = require('@ffmpeg-installer/ffmpeg').path;
const ffmpeg = require('fluent-ffmpeg');
ffmpeg.setFfmpegPath(ffmpegPath);
var ffprobe = require('ffprobe-static');
ffmpeg.setFfprobePath(ffprobe.path);
const axios = require('axios');
const crypto = require('crypto');
const path = require('path');


const overlayBackgroundAudio = async (inputFileName, backgroundFileUrl) => {

 const backgroundTrack = await axios({
 method: 'GET',
 url: backgroundFileUrl,
 responseType: 'arraybuffer'
 });

 // write a file with the retrieved background audio track
 const backgroundTrackFileName = crypto.randomBytes(12).toString('hex');
 fs.writeFileSync(`${backgroundTrackFileName}.mp3`, backgroundTrack.data); //todo - delete after


 // set the name of the output file
 const newFileName = crypto.randomBytes(12).toString('hex');
 const outputFileName = `${newFileName}.mp3`;

 // run the relevant ffmpeg commands

 const overlayTracks = async () => {
 
 return new Promise((resolve, reject) => {
 ffmpeg()
 .input(`${inputFileName}.mp3`)
 .input(`${backgroundTrackFileName}.mp3`)
 .complexFilter([
 {
 filter: 'volume',
 options: '1',
 inputs: '[0:0]',
 outputs: '[a]'
 },
 {
 filter: 'volume',
 options: '1',
 inputs: '[1:0]',
 outputs: '[b]'
 },
 {
 filter: 'adelay',
 options: '0',
 inputs: '[a]',
 outputs: '[a1]'
 },
 {
 filter: 'adelay',
 options: '0|0',
 inputs: '[b]',
 outputs: '[b1]'
 },
 {
 filter: 'amix',
 options: 'inputs=2:duration=first',
 inputs: '[a1][b1]',
 outputs: '[out]'
 }
 ])
 .outputOptions(['-map', '[out]', outputFileName])
 .output(outputFileName)
 .on('end', function() {
 resolve(outputFileName);
 })
 .on('stderr', console.log) // log ffmpeg output to console
 .on('error', function(err) {
 console.log(`An error occurred overlaying tracks: ${err.message}`);
 reject(err);
 })
 .run()
 })
 }

 const overlaidTracksFileName = await overlayTracks();

 console.log('overlaid file name:', overlaidTracksFileName)

 return overlaidTracksFileName;
 
}

module.exports = overlayBackgroundAudio;



Here is what the ffmpeg library is logging to my console (which may help in figuring out why this is not working as intended) :


Input #0, mp3, from '95c8ec8ccbb100d2bfe81ffd.mp3':
 Metadata:
 encoder : Lavf58.24.101
 Duration: 00:02:41.42, start: 0.046042, bitrate: 48 kb/s
 Stream #0:0: Audio: mp3, 24000 Hz, mono, fltp, 48 kb/s
[mp3 @ 000002c77978ddc0] Estimating duration from bitrate, this may be inaccurate
Input #1, mp3, from '14e70bbd339b612e96f29017.mp3':
 Metadata:
 date : 2022-12-30 17:56
 id3v2_priv.XMP : <?xpacket begin="\xef\xbb\xbf" id="W5M0MpCehiHzreSzNTczkc9d"?>\x0a\x0a \x0a s
 Stream #1:0: Audio: mp3, 48000 Hz, stereo, fltp, 192 kb/s
Stream mapping:
 Stream #0:0 (mp3float) -> volume (graph 0)
 Stream #1:0 (mp3float) -> volume (graph 0)
 amix (graph 0) -> Stream #0:0 (libmp3lame)
 Stream #1:0 -> #1:0 (mp3 (mp3float) -> mp3 (libmp3lame))
Press [q] to stop, [?] for help
Output #0, mp3, to '0c0404b793d488bf38e882a0.mp3':
 Metadata:
 TSSE : Lavf58.24.101
 Stream #0:0: Audio: mp3 (libmp3lame), 24000 Hz, mono, fltp (default)
 Metadata:
 encoder : Lavc58.42.102 libmp3lame
Output #1, mp3, to '0c0404b793d488bf38e882a0.mp3':
 Metadata:
 TSSE : Lavf58.24.101
 Stream #1:0: Audio: mp3 (libmp3lame), 48000 Hz, stereo, fltp
 Metadata:
 encoder : Lavc58.42.102 libmp3lame





Thank you very much in advance for any help that you can try to provide !