
Recherche avancée
Autres articles (37)
-
Contribute to a better visual interface
13 avril 2011MediaSPIP is based on a system of themes and templates. Templates define the placement of information on the page, and can be adapted to a wide range of uses. Themes define the overall graphic appearance of the site.
Anyone can submit a new graphic theme or template and make it available to the MediaSPIP community. -
Qu’est ce qu’un éditorial
21 juin 2013, parEcrivez votre de point de vue dans un article. Celui-ci sera rangé dans une rubrique prévue à cet effet.
Un éditorial est un article de type texte uniquement. Il a pour objectif de ranger les points de vue dans une rubrique dédiée. Un seul éditorial est placé à la une en page d’accueil. Pour consulter les précédents, consultez la rubrique dédiée.
Vous pouvez personnaliser le formulaire de création d’un éditorial.
Formulaire de création d’un éditorial Dans le cas d’un document de type éditorial, les (...) -
Dépôt de média et thèmes par FTP
31 mai 2013, parL’outil MédiaSPIP traite aussi les média transférés par la voie FTP. Si vous préférez déposer par cette voie, récupérez les identifiants d’accès vers votre site MédiaSPIP et utilisez votre client FTP favori.
Vous trouverez dès le départ les dossiers suivants dans votre espace FTP : config/ : dossier de configuration du site IMG/ : dossier des média déjà traités et en ligne sur le site local/ : répertoire cache du site web themes/ : les thèmes ou les feuilles de style personnalisées tmp/ : dossier de travail (...)
Sur d’autres sites (3462)
-
how to attach a image in background using node-ffmpeg ?
24 juillet 2018, par NaneI am really confused that how to attach image in the background and run the video in front Like that
Code (this code returns only audio)
ffmpeg()
.input("front.mp4")
.input('./bg.jpg')
.complexFilter([
'overlay=(W-w)/2:(H-h)/2:shortest=1,format=yuv420p',
])
.output("output.mp4")
.on("error",function(er){
console.log("error occured: "+er.message);
})
.on('start', function() {
console.log('file starting');
})
.on('progress', function(progress) {
console.log('Processing: ' + progress.percent + '% done');
})
.on('codecData', function(data) {
console.log('Input is ' + data.audio + ' audio ' +
'with ' + data.video + ' video');
})
.on("end",function(){
console.log("success");
})
.run(); -
How to add an album cover to an mp3 stream using FFmpeg ?
29 décembre 2022, par Daniel LAPIDESI'm having a bit of an issue and I'd really appreciate it if I could get some insights.



What I am trying to do is to add an album cover to the mp3 file that will be downloaded from the front-end.



Context



I'm downloading a video stream from YouTube and converting it to mp3 using
fluent-ffmpeg
.

To get the video I use theytdl
npm module.


I then pipe this stream to the front-end.



What I've found



fluent-ffmpeg
offers eitherpipe()
orsaveToFile()
.


What I figured is that when I use the
saveToFile()
function and actually save my stream into an mp3 file, it works, I do get the album cover.


But when I pipe the stream to front-end or even into a file, the song is saved properly into a file but without the album cover.



Here is my code



Back-end (NodeJS)



let video = ytdl(`http://youtube.com/watch?v=${videoId}`, {
 filter: (format) => format.container === 'mp4' && format.audioEncoding,
 quality: 'lowest'
});

let stream = new FFmpeg()
 .input(video)
 .addInput(`https://i.ytimg.com/vi/${videoId}/default.jpg`)
 .outputOptions([
 '-map 0:1',
 '-map 1:0',
 '-c copy',
 '-c:a libmp3lame',
 '-id3v2_version 3',
 '-metadata:s:v title="Album cover"',
 '-metadata:s:v comment="Cover (front)"'
 ])
 .format('mp3');




And then piping it to my front-end.



stream.pipe(res);
stream
 .on('end', () => {
 console.log('******* Stream end *******');
 res.end.bind(res);
 })
 .on('error', (err) => {
 console.log('ERR', err);
 res.status(500).end.bind(res);
 });




Front-end (React)



axios.get(url)
 .then(res => {
 axios(`${url}/download`, {
 method: 'GET',
 responseType: 'blob'
 })
 .then(stream => {
 const file = new Blob(
 [stream.data],
 { type: 'audio/mpeg' });
 //Build a URL from the file
 const fileURL = URL.createObjectURL(file);
 })
 .catch(err => {
 console.log('ERROR', err);
 });
 })
 .catch(err => {
 console.log('ERROR', err);
 });



-
FFMPEG : avcodec_send_packet() ; error while using multithread
13 juillet 2018, par Trần Quốc ViệtI wrote 2 threads to decode RTSP stream from IP camera as below :
RTSP_read_paket function used to read Packets from RTSP link, packets stored in a queue named Packet_buf.
std::queue<avpacket> Packet_buf;
bool pkt_pending_k = false;
int RTSP_read_packet (string url)
{
rtsp_init(url);
int ret;
AVPacket packet;
av_init_packet(&packet);
while(1)
{
ret = av_read_frame(pFormatCtx,&packet);
if(ret==0)
{
if (packet.stream_index == video_stream_index)
{
Packet_buf.push(packet);
if((ready1 == false))
{
ready1 = true;
conv1.notify_one();
}
}
av_packet_unref(&packet);
cout<<"number of RTSP packet: "<code></avpacket>ffmpeg_decode read packets from Packet_buf to decode frames
AVFrame ffmpeg_decode( void )
{
AVPacket avpkt;
av_init_packet(&avpkt);
int ret;
conv1.wait(lk1,[]{return ready1;});
while(1)
{
while(1)
{
ret = avcodec_receive_frame(pCodecCtx,pFrame);
if(ret == AVERROR(EAGAIN)||ret==AVERROR_EOF){
break;
}
return pFrame;
}
if(!Packet_buf.empty())
{
if(pkt_pending_k == false)
{
avpkt = Packet_buf.front();
Packet_buf.pop();
}else{
pkt_pending_k = false;
}
}
ret = avcodec_send_packet(pCodecCtx, &avpkt); //program halting here
cout<<"-------------> ret = "<code>My program halt at line :
ret = avcodec_send_packet(pCodecCtx, &avpkt);
Anyone can help me find the problem, thanks !
P/s :
rtsp_init function :int rtsp_init (string url)
{
av_register_all();
avdevice_register_all();
avcodec_register_all();
avformat_network_init();
const char *filenameSrc = url.c_str();
pFormatCtx = avformat_alloc_context();
if ( pFormatCtx == NULL )
return -8;
AVDictionary *options = NULL;
av_dict_set(&options,"rtsp_flags","prefer_tcp",0);
av_dict_set(&options,"stimeout","1000000",0);
int avret = avformat_open_input( &pFormatCtx, filenameSrc, NULL, &options );
av_dict_free(&options);
if ( avret != 0 ) {
std::cout << "Open File Error 12" << std::endl;
return -12;
}
avret = avformat_find_stream_info( pFormatCtx, NULL );
if ( avret < 0 ) {
std::cout << "Get Stream Information Error 13" << std::endl;
avformat_close_input( &pFormatCtx );
pFormatCtx = NULL;
return -13;
}
av_dump_format( pFormatCtx, 0, filenameSrc, 0 );
video_stream_index = av_find_best_stream(pFormatCtx,AVMEDIA_TYPE_VIDEO,-1,-1,NULL,0);
if ( video_stream_index < 0 ) {
std::cout << "Video stream was not found Error 14" << std::endl;
avformat_close_input( &pFormatCtx );
pFormatCtx = NULL;
return -14;
}
pCodecCtx = avcodec_alloc_context3(NULL);
avret = avcodec_parameters_to_context(pCodecCtx,pFormatCtx->streams[video_stream_index]->codecpar);
if(avret<0)
{
std::cout << "codec not found Error 15" << std::endl;
return -15;
}
pCodec = avcodec_find_decoder( pCodecCtx->codec_id );
avret = avcodec_open2( pCodecCtx, pCodec, NULL );
if ( avret < 0) {
std::cout << "Open Codec Error 16" << std::endl;
return -16;
}
pFrame = av_frame_alloc();
pFrameRGB = av_frame_alloc();
pFrame->width = pCodecCtx->width;
pFrame->height = pCodecCtx->height;
pFrame->format = pCodecCtx->pix_fmt;
avret = av_frame_get_buffer(pFrame,0);
if (avret < 0)
{
return -17;
}
pFrameRGB->width = pCodecCtx->width;
pFrameRGB->height = pCodecCtx->height;
pFrameRGB->format = AV_PIX_FMT_BGR24;
avret = av_frame_get_buffer(pFrameRGB, 0);
if (avret < 0)
{
return -18;
}
return ( EXIT_SUCCESS );
}