
Recherche avancée
Médias (2)
-
Core Media Video
4 avril 2013, par
Mis à jour : Juin 2013
Langue : français
Type : Video
-
Video d’abeille en portrait
14 mai 2011, par
Mis à jour : Février 2012
Langue : français
Type : Video
Autres articles (34)
-
Ajouter notes et légendes aux images
7 février 2011, parPour pouvoir ajouter notes et légendes aux images, la première étape est d’installer le plugin "Légendes".
Une fois le plugin activé, vous pouvez le configurer dans l’espace de configuration afin de modifier les droits de création / modification et de suppression des notes. Par défaut seuls les administrateurs du site peuvent ajouter des notes aux images.
Modification lors de l’ajout d’un média
Lors de l’ajout d’un média de type "image" un nouveau bouton apparait au dessus de la prévisualisation (...) -
Librairies et binaires spécifiques au traitement vidéo et sonore
31 janvier 2010, parLes logiciels et librairies suivantes sont utilisées par SPIPmotion d’une manière ou d’une autre.
Binaires obligatoires FFMpeg : encodeur principal, permet de transcoder presque tous les types de fichiers vidéo et sonores dans les formats lisibles sur Internet. CF ce tutoriel pour son installation ; Oggz-tools : outils d’inspection de fichiers ogg ; Mediainfo : récupération d’informations depuis la plupart des formats vidéos et sonores ;
Binaires complémentaires et facultatifs flvtool2 : (...) -
Support audio et vidéo HTML5
10 avril 2011MediaSPIP utilise les balises HTML5 video et audio pour la lecture de documents multimedia en profitant des dernières innovations du W3C supportées par les navigateurs modernes.
Pour les navigateurs plus anciens, le lecteur flash Flowplayer est utilisé.
Le lecteur HTML5 utilisé a été spécifiquement créé pour MediaSPIP : il est complètement modifiable graphiquement pour correspondre à un thème choisi.
Ces technologies permettent de distribuer vidéo et son à la fois sur des ordinateurs conventionnels (...)
Sur d’autres sites (3683)
-
Shell Script for passing multiple audio sources as arguments to a script that uses ffmpeg for recording video/audio ? [duplicate]
29 novembre 2023, par Raul ChiarellaI have the following Shell/Bash Script, that records video with audio in my Linux :


#!/bin/bash

# Command to record audio from one microphone and video from one webcam
ffmpeg_cmd="ffmpeg -f video4linux2 -s 320x240 -i /dev/video0 -f alsa -ac 1 -i hw:1,0 -acodec libmp3lame -ab 96k camera.mp4"

# Execute the command
echo "Executing: $ffmpeg_cmd"
eval $ffmpeg_cmd



This one works... But now :


What I want is to be able to execute this Bash/Shell script passing multiple audio sources parameters and changing if video is going to be recorded or not (Video 1 Enabled, Video 0 Disabled), for example, using
./recordVideo.sh -a "audio1,audio2" -v 1
...

I tried recording a video accepting multiple audio sources arguments and passing it to FFMPEG using the following script :


#!/bin/bash

# Default variables
audio_sources=""
video_flag=0

# Function to display help
usage() {
 echo "Usage: $0 -a 'Microphone1,Microphone2' -v 1"
 echo " -a : List of audio sources, separated by commas"
 echo " -v : Video flag (1 to record video, 0 not to record)"
 exit 1
}

# Parse arguments
while getopts "a,v" opt; do
 case $opt in
 a) audio_sources=$OPTARG ;;
 v) video_flag=$OPTARG ;;
 *) usage ;;
 esac
done

# Check if audio arguments were provided
if [ -z "$audio_sources" ]; then
 echo "Error: Audio sources not specified."
 usage
fi

# Initial ffmpeg command configuration
cmd="ffmpeg"

# Counter for source mapping
source_count=0

# Audio settings
IFS=',' read -ra ADDR <<< "$audio_sources"
for source in $ADDR; do
 cmd+=" -f alsa -ac 1 -i $source"
 cmd+=" -map $source_count"
 ((source_count++))
done

# Video settings
if [ "$video_flag" -eq 1 ]; then
 cmd+=" -f video4linux2 -s 320x240 -i /dev/video0 -map $source_count"
 ((source_count++))
fi

# Audio codec configuration
cmd+=" -acodec libmp3lame -ab 96k"

# Output file name
cmd+=" recordedVideo.mp4"

# Execute command
echo "Executing: $cmd"
eval $cmd



But it is throwing the following error when I execute
./recordVideo.sh -a 'Microphone1,Microphone2' -v 1
:



Error : Audio sources not specified.
Usage : ./recordVideo.sh -a 'Microphone1,Microphone2' -v 1
-a : List of audio sources, separated by commas
-v : Video flag (1 to record video, 0 not to record)




Can someone help me ? :(
What am I doing wrong ? Is it the Shell Syntax or FFMPEG arguments that are wrong ?


-
How to make audio sound batter ? (C + FFMpeg audio generation example)
31 janvier 2014, par SpenderSo I found this grate C FFMpeg official example which I simplified :
#include
#include
#include
#ifdef HAVE_AV_CONFIG_H
#undef HAVE_AV_CONFIG_H
#endif
#include "libavcodec/avcodec.h"
#include "libavutil/mathematics.h"
#define INBUF_SIZE 4096
#define AUDIO_INBUF_SIZE 20480
#define AUDIO_REFILL_THRESH 4096
/*
* Audio encoding example
*/
static void audio_encode_example(const char *filename)
{
AVCodec *codec;
AVCodecContext *c= NULL;
int frame_size, i, j, out_size, outbuf_size;
FILE *f;
short *samples;
float t, tincr;
uint8_t *outbuf;
printf("Audio encoding\n");
/* find the MP2 encoder */
codec = avcodec_find_encoder(CODEC_ID_MP2);
if (!codec) {
fprintf(stderr, "codec not found\n");
exit(1);
}
c= avcodec_alloc_context();
/* put sample parameters */
c->bit_rate = 64000;
c->sample_rate = 44100;
c->channels = 2;
/* open it */
if (avcodec_open(c, codec) < 0) {
fprintf(stderr, "could not open codec\n");
exit(1);
}
/* the codec gives us the frame size, in samples */
frame_size = c->frame_size;
samples = malloc(frame_size * 2 * c->channels);
outbuf_size = 10000;
outbuf = malloc(outbuf_size);
f = fopen(filename, "wb");
if (!f) {
fprintf(stderr, "could not open %s\n", filename);
exit(1);
}
/* encode a single tone sound */
t = 0;
tincr = 2 * M_PI * 440.0 / c->sample_rate;
for(i=0;i<200;i++) {
for(j=0;j* encode the samples */
out_size = avcodec_encode_audio(c, outbuf, outbuf_size, samples);
fwrite(outbuf, 1, out_size, f);
}
fclose(f);
free(outbuf);
free(samples);
avcodec_close(c);
av_free(c);
}
int main(int argc, char **argv)
{
/* must be called before using avcodec lib */
avcodec_init();
/* register all the codecs */
avcodec_register_all();
audio_encode_example("test.mp2");
return 0;
}How should it sound like ? May be I don't get something but it sounds awful =( how to make audio generation sound batter/ more interesting/ melodical in a wary shourt way (no special functions just how to change this code to make it sound batter) ?
-
ffmpeg replacing audio track with track from another video but different length (sync audio)
27 août 2019, par MattBackground
I have digitized some old Canon Video8 tapes. I used a SONY Digital8 camera (which is backwards compatible with Video8) to output DV (using it’s inbuilt ADC). The conversion process worked well for the video but the audio came through jumpy/distorted in places. This left me with a problem, was it the Camera or the tape ? So I bought another Samsung Video8 camera (just analog) and using the SONY’s passthrough feature output from the Samsung (Composite & mono audio) into the SONY which output the DV. Much to my delight it worked ! The audio was clear.
Result
DV01.avi - Good Video / Crap Audio
DV02.avi - Crap Video / Good AudioOk so obviously what I would like to do is take the video track from DV01 and the audio track from DV02 and join/mux ? them WITHOUT re-encoding.
Problem 1 : They have different start times so just copying over the audio track will result it not being in sync.
After some googling I found you can use ffmpeg to take care of this :
Firstly here is the Video info using :
ffmpeg -i DV01.avi
Input #0, avi, from 'DV01.avi':
Duration: 02:53:06.68, start: 0.000000, bitrate: 28878 kb/s
Stream #0:0: Video: dvvideo, yuv420p, 720x576 [SAR 16:15 DAR 4:3], 25000 kb/s, 25 fps, 25 tbr, 25 tbn, 25 tbc
Stream #0:1: Audio: pcm_s16le, 32000 Hz, stereo, s16, 1024 kb/s
Stream #0:2: Audio: pcm_s16le, 32000 Hz, stereo, s16, 1024 kb/sMuxing :
ffmpeg -itsoffset 4 -i DV01.avi -i DV02.avi -map 0:v -map 1:a -c copy output.avi
In the example above I am delaying the start of the video 4 seconds (I think ?) This is just an example I haven’t actually tried it as the file sizes are 40Gb !
So my QUESTION is :
Given the background above what would be the best way to join/mux the two streams together (without re-encoding) with the audio being in sync. Given that syncing the audio to the video may need millisecond tweaking I don’t believe trial and error is a good idea (I don’t want to tweak it by 10ms then rinse and repeat for a 40Gb file) ?
I just had a thought, could I say create a 10 second clip (from the start) of each video and use them to find the reference/sync start point then use that when muxing the 40Gb versions ?
Anyway, you get the idea. Looking for ways to solve this problem. Thanks !