
Recherche avancée
Autres articles (27)
-
MediaSPIP v0.2
21 juin 2013, parMediaSPIP 0.2 est la première version de MediaSPIP stable.
Sa date de sortie officielle est le 21 juin 2013 et est annoncée ici.
Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
Comme pour la version précédente, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...) -
Mise à disposition des fichiers
14 avril 2011, parPar défaut, lors de son initialisation, MediaSPIP ne permet pas aux visiteurs de télécharger les fichiers qu’ils soient originaux ou le résultat de leur transformation ou encodage. Il permet uniquement de les visualiser.
Cependant, il est possible et facile d’autoriser les visiteurs à avoir accès à ces documents et ce sous différentes formes.
Tout cela se passe dans la page de configuration du squelette. Il vous faut aller dans l’espace d’administration du canal, et choisir dans la navigation (...) -
MediaSPIP version 0.1 Beta
16 avril 2011, parMediaSPIP 0.1 beta est la première version de MediaSPIP décrétée comme "utilisable".
Le fichier zip ici présent contient uniquement les sources de MediaSPIP en version standalone.
Pour avoir une installation fonctionnelle, il est nécessaire d’installer manuellement l’ensemble des dépendances logicielles sur le serveur.
Si vous souhaitez utiliser cette archive pour une installation en mode ferme, il vous faudra également procéder à d’autres modifications (...)
Sur d’autres sites (4479)
-
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 !


-
why would ffmpeg rotate 2nd video on concatenation when I don't want it to or seemingly ask for it ?
10 janvier 2023, par Pompey Magnushere is the command I run :


ffmpeg -f concat -an -i ./files.txt ztestout.mp4



I have about 5 videos, but just to test I did with two.
the 2nd video gets flipped upside down, even though opening each video in VLC opens and plays them correctly.


Any ideas why it would do that ? Is the metadata wrong in the video ? I took all the videos I'm trying to concat with the same android phone.


output below, and I noticed its says rotation zero degrees :


ffmpeg version 5.1.2 Copyright (c) 2000-2022 the FFmpeg developers
 built with Apple clang version 14.0.0 (clang-1400.0.29.102)
 configuration: --prefix=/opt/homebrew/Cellar/ffmpeg/5.1.2 --enable-shared --enable-pthreads --enable-version3 --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librist --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox --enable-neon
 libavutil 57. 28.100 / 57. 28.100
 libavcodec 59. 37.100 / 59. 37.100
 libavformat 59. 27.100 / 59. 27.100
 libavdevice 59. 7.100 / 59. 7.100
 libavfilter 8. 44.100 / 8. 44.100
 libswscale 6. 7.100 / 6. 7.100
 libswresample 4. 7.100 / 4. 7.100
 libpostproc 56. 6.100 / 56. 6.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x138804730] Auto-inserting h264_mp4toannexb bitstream filter
Input #0, concat, from './files.txt':
 Duration: N/A, start: 0.000000, bitrate: 17255 kb/s
 Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, smpte170m, progressive), 1920x1080, 16999 kb/s, SAR 1:1 DAR 16:9, 30.01 fps, 30 tbr, 90k tbn
 Metadata:
 creation_time : 2023-01-08T13:32:50.000000Z
 handler_name : VideoHandle
 vendor_id : [0][0][0][0]
 Side data:
 displaymatrix: rotation of -180.00 degrees
 Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 256 kb/s
 Metadata:
 creation_time : 2023-01-08T13:32:50.000000Z
 handler_name : SoundHandle
 vendor_id : [0][0][0][0]
Stream mapping:
 Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[libx264 @ 0x137f07fe0] using SAR=1/1
[libx264 @ 0x137f07fe0] using cpu capabilities: ARMv8 NEON
[libx264 @ 0x137f07fe0] profile High, level 4.0, 4:2:0, 8-bit
[libx264 @ 0x137f07fe0] 264 - core 164 r3095 baee400 - H.264/MPEG-4 AVC codec - Copyleft 2003-2022 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=15 lookahead_threads=2 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=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'ztestout.mp4':
 Metadata:
 encoder : Lavf59.27.100
 Stream #0:0(eng): Video: h264 (avc1 / 0x31637661), yuvj420p(pc, smpte170m, progressive), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 30 fps, 15360 tbn
 Metadata:
 creation_time : 2023-01-08T13:32:50.000000Z
 handler_name : VideoHandle
 vendor_id : [0][0][0][0]
 encoder : Lavc59.37.100 libx264
 Side data:
 cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: N/A
 displaymatrix: rotation of -0.00 degrees
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x138904b40] Auto-inserting h264_mp4toannexb bitstream filterdrop=20 speed=3.67x 
frame=74497 fps=109 q=-1.0 Lsize= 1740353kB time=00:41:23.13 bitrate=5741.5kbits/s dup=0 drop=25 speed=3.64x 
video:1739531kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.047236%
[libx264 @ 0x137f07fe0] frame I:300 Avg QP:20.73 size:294110
[libx264 @ 0x137f07fe0] frame P:29265 Avg QP:23.65 size: 45500
[libx264 @ 0x137f07fe0] frame B:44932 Avg QP:27.95 size: 8045
[libx264 @ 0x137f07fe0] consecutive B-frames: 19.4% 0.4% 0.7% 79.5%
[libx264 @ 0x137f07fe0] mb I I16..4: 5.5% 43.8% 50.7%
[libx264 @ 0x137f07fe0] mb P I16..4: 0.2% 0.9% 0.7% P16..4: 36.9% 13.9% 10.8% 0.0% 0.0% skip:36.6%
[libx264 @ 0x137f07fe0] mb B I16..4: 0.0% 0.1% 0.1% B16..8: 30.0% 3.0% 1.3% direct: 1.1% skip:64.3% L0:38.1% L1:55.8% BI: 6.1%
[libx264 @ 0x137f07fe0] 8x8 transform intra:49.7% inter:45.0%
[libx264 @ 0x137f07fe0] coded y,uvDC,uvAC intra: 84.0% 82.3% 41.9% inter: 12.8% 10.8% 0.5%
[libx264 @ 0x137f07fe0] i16 v,h,dc,p: 30% 17% 8% 45%
[libx264 @ 0x137f07fe0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 17% 25% 12% 4% 7% 7% 12% 7% 8%
[libx264 @ 0x137f07fe0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 21% 25% 12% 5% 7% 7% 10% 6% 8%
[libx264 @ 0x137f07fe0] i8c dc,h,v,p: 47% 22% 22% 9%
[libx264 @ 0x137f07fe0] Weighted P-Frames: Y:0.3% UV:0.0%
[libx264 @ 0x137f07fe0] ref P L0: 70.3% 10.7% 13.9% 5.0% 0.0%
[libx264 @ 0x137f07fe0] ref B L0: 91.8% 6.2% 2.0%
[libx264 @ 0x137f07fe0] ref B L1: 95.7% 4.3%
[libx264 @ 0x137f07fe0] kb/s:5738.58



-
Checking if a video has a sound even if it has an audio codec ?
19 janvier 2023, par SreenivasanI am new to intermediate python and I am trying to find if a downloaded video has sound, every video I download has an audio codec but I want to get the decibel of sound that audio has in that particular video.


For example, this 'FFmpeg' command line script allows me to get the full info :


ffmpeg -hide_banner -i testvideo.mp4 -af volumedetect -vn -f null - 2>&1



this yields the below result in my command prompt(windows user here with win 11)


Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'testvideo.mp4':

Metadata:

major_brand : mp42

minor_version : 0

compatible_brands: mp42mp41isomavc1

creation_time : 2022-04-12T23:21:45.000000Z

Duration: 00:00:40.58, start: 0.000000, bitrate: 4104 kb/s

Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709, progressive), 1920x1080, 3846 kb/s, 29.97 fps, 29.97 tbr, 30k tbn (default)

Metadata:

creation_time : 2022-04-12T23:21:45.000000Z

handler_name : L-SMASH Video Handler

vendor_id : [0][0][0][0]

encoder : AVC Coding

Stream #0:1[0x2](und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 253 kb/s (default)

Metadata:

creation_time : 2022-04-12T23:21:45.000000Z

handler_name : L-SMASH Audio Handler

vendor_id : [0][0][0][0]

Stream mapping:

Stream #0:1 -> #0:0 (aac (native) -> pcm_s16le (native))

Press [q] to stop, [?] for help

Output #0, null, to 'pipe:':

Metadata:

major_brand : mp42

minor_version : 0

compatible_brands: mp42mp41isomavc1

encoder : Lavf59.35.100

Stream #0:0(und): Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s (default)

Metadata:

creation_time : 2022-04-12T23:21:45.000000Z

handler_name : L-SMASH Audio Handler

vendor_id : [0][0][0][0]

encoder : Lavc59.56.100 pcm_s16le

size=N/A time=00:00:40.55 bitrate=N/A speed=1.22e+03x

video:0kB audio:7608kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

[Parsed_volumedetect_0 @ 0000026609be08c0] n_samples: 3895296

[Parsed_volumedetect_0 @ 0000026609be08c0] mean_volume: -91.0 dB

[Parsed_volumedetect_0 @ 0000026609be08c0] max_volume: -91.0 dB

[Parsed_volumedetect_0 @ 0000026609be08c0] histogram_91db: 3895296



As you can see there are 'parsed_volumedetect' values with dB which has a mean value of -91 dB which means the audio has no sound, i.e., the video has audio but there is no sound.


Now I am trying to do the same in python and I want to get just the mean volume value to be stored in a variable so that I can check if the video has any sound in it.


I have seen the subprocess codes so far but when I try to run my code in VS-Code - python 3.11 :


import subprocess 
result = subprocess.run(["ffmpeg", "-hide_banner", "-af", "volumedetect", "-vn", "-f", "null", "testvideo1.mp4"],
 stdout=subprocess.PIPE,
 stderr=subprocess.STDOUT,
 shell=True)
 print(result.stdout)



It says that :


PS C:\Users\balaj\OneDrive\Documents\Programming language\python files> c:; cd 'c:\Users\balaj\OneDrive\Documents\Programming language\python files'; & 'C:\Python311\python.exe' 'c:\Users\balaj\.vscode\extensions\ms-python.python-2022.20.2\pythonFiles\lib\python\debugpy\adapter/../..\debugpy\launcher' '51760' '--' 'c:\Users\balaj\OneDrive\Documents\Programming language\python files\devproject\sample.py'

b"Output #0, null, to 'testvideo1.mp4':\r\nOutput file #0 does not contain any stream\r\n"



Any help is much appreciated. Sorry for the long post... TIA !!!


Just a quick update :
The result is the same for video files that have sound(I tested in VLC) and don't have sound.


Another update :
I have changed the
subprocess.run
code to the exact same as I called in the cmd windows :

result = subprocess.run(["ffmpeg", "-hide_banner","-i","testvideo-sound.mp4", "-af", "volumedetect", "-vn", "-f", "null", "-2>&1"]



Now the result is this :


b'The handle could not be duplicated\r\nduring redirection of handle 1.\r\n'