
Recherche avancée
Médias (3)
-
Elephants Dream - Cover of the soundtrack
17 octobre 2011, par
Mis à jour : Octobre 2011
Langue : English
Type : Image
-
Valkaama DVD Label
4 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Image
-
Publier une image simplement
13 avril 2011, par ,
Mis à jour : Février 2012
Langue : français
Type : Video
Autres articles (27)
-
La file d’attente de SPIPmotion
28 novembre 2010, parUne file d’attente stockée dans la base de donnée
Lors de son installation, SPIPmotion crée une nouvelle table dans la base de donnée intitulée spip_spipmotion_attentes.
Cette nouvelle table est constituée des champs suivants : id_spipmotion_attente, l’identifiant numérique unique de la tâche à traiter ; id_document, l’identifiant numérique du document original à encoder ; id_objet l’identifiant unique de l’objet auquel le document encodé devra être attaché automatiquement ; objet, le type d’objet auquel (...) -
Emballe médias : à quoi cela sert ?
4 février 2011, parCe plugin vise à gérer des sites de mise en ligne de documents de tous types.
Il crée des "médias", à savoir : un "média" est un article au sens SPIP créé automatiquement lors du téléversement d’un document qu’il soit audio, vidéo, image ou textuel ; un seul document ne peut être lié à un article dit "média" ; -
D’autres logiciels intéressants
12 avril 2011, parOn ne revendique pas d’être les seuls à faire ce que l’on fait ... et on ne revendique surtout pas d’être les meilleurs non plus ... Ce que l’on fait, on essaie juste de le faire bien, et de mieux en mieux...
La liste suivante correspond à des logiciels qui tendent peu ou prou à faire comme MediaSPIP ou que MediaSPIP tente peu ou prou à faire pareil, peu importe ...
On ne les connais pas, on ne les a pas essayé, mais vous pouvez peut être y jeter un coup d’oeil.
Videopress
Site Internet : (...)
Sur d’autres sites (5732)
-
warning : Error opening file (../../modules/videoio/src/cap_ffmpeg_impl.hpp:554)
7 mars 2016, par Bessy Georgethis is my code for applying kmeans algorithm in video.It is written in ceemple( opencv)as a cpp file.it is used to read data from video and apply kmeans for each frame. could you please help me.
thanks in advance#include "opencv2/opencv.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/core.hpp"
#include "opencv2/imgproc.hpp"
#include <iostream>
#include <opencv></opencv>ml.h>
using namespace cv;
int main(int, char**)
{
Scalar colorTab[] =
{
Scalar(0, 0, 255),
Scalar(0,255,0),
Scalar(255,100,100),
Scalar(255,0,255),
Scalar(0,255,255)
};
//VideoCapture cap(0); // open the default camera
String filename = "ab.avi";
VideoCapture cap(filename);
RNG rng(12345);
if(!cap.isOpened()) // check if we succeeded
return -1;
const int MAX_CLUSTERS = 5;
Mat edges;
namedWindow("edges",1);
for(;;)
{
Mat frame;
cap >> frame; // get a new frame from camera
/* cvtColor(frame, edges, CV_BGR2GRAY);
GaussianBlur(edges, edges, Size(7,7), 1.5, 1.5);
Canny(edges, edges, 0, 30, 3);
cv::Mat centers;cv::Mat labels;
kmeans(frame, 8, labels,TermCriteria( TermCriteria::EPS+TermCriteria::COUNT, 10, 1.0),3, cv::KMEANS_PP_CENTERS, centers);
frame = Scalar::all(0);
imshow("edges", frame);
if(waitKey(30) >= 0) break;*/
int k, clusterCount = rng.uniform(2, MAX_CLUSTERS+1);
int i, sampleCount = rng.uniform(1, 1001);
Mat points(sampleCount, 1, CV_32FC2), labels;
clusterCount = MIN(clusterCount, sampleCount);
Mat centers;
/* generate random sample from multigaussian distribution */
for( k = 0; k < clusterCount; k++ )
{
Point center;
center.x = rng.uniform(0, frame.cols);
center.y = rng.uniform(0, frame.rows);
Mat pointChunk = points.rowRange(k*sampleCount/clusterCount,
k == clusterCount - 1 ? sampleCount :
(k+1)*sampleCount/clusterCount);
rng.fill(pointChunk, RNG::NORMAL, Scalar(center.x, center.y), Scalar(frame.cols*0.05, frame.rows*0.05));
}
randShuffle(points, 1, &rng);
kmeans(points, clusterCount, labels,
TermCriteria( TermCriteria::EPS+TermCriteria::COUNT, 10, 1.0),
3, KMEANS_PP_CENTERS, centers);
frame = Scalar::all(0);
for( i = 0; i < sampleCount; i++ )
{
int clusterIdx = labels.at<int>(i);
Point ipt = points.at<point2f>(i);
circle( frame, ipt, 2, colorTab[clusterIdx], FILLED, LINE_AA );
}
imshow("clusters", frame);
char key = (char)waitKey();
if( key == 27 || key == 'q' || key == 'Q' ) // 'ESC'
break;
}
return 0;
}
</point2f></int></iostream> -
FFmpeg API - transcoding and sending pulseaudio input (rtsp)
16 octobre 2020, par user3469024My goal is to read pulseaudio microphone audio input and send it via rtsp encoded as opus. To play stream I am using ffplay.


What step am I missing ? Currently I am hearing only noise when receiving stream. What is interesting,
av_dump_format
shows correct output :

Input #0, pulse, from 'default':
 Duration: N/A, start: 1602879120.276839, bitrate: 1536 kb/s
 Stream #0:0: Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s
Output #0, rtsp, to 'rtsp://localhost:8191/call':
 Stream #0:0: Audio: opus, 8000 Hz, mono, s16, 16 kb/s




but ffplay shows different stream parameters :


Input #0, rtsp, from 'rtsp://localhost:8191/call':sq= 0B f=0/0 
 Metadata:
 title : No Name
 Duration: N/A, start: 51444.871521, bitrate: N/A
 Stream #0:0: Audio: opus, 48000 Hz, stereo, fltp




#include <libavcodec></libavcodec>avcodec.h>
#include <libavformat></libavformat>avformat.h>
#include <libswscale></libswscale>swscale.h>
#include 

int main(int argc, char *argv[])
{
 int ret,got_frame,got_packet;
 const char *audio_input;
 const char *output;
 AVOutputFormat *out_format = NULL;
 AVInputFormat *in_format = NULL;
 AVFormatContext *in_format_ctx = NULL;
 AVFormatContext *out_format_ctx = NULL;
 AVCodec *in_codec = NULL;
 AVCodecContext *in_codec_ctx = NULL;
 AVCodec *out_codec = NULL;
 AVCodecContext *out_codec_ctx = NULL;
 AVPacket packet = { .data = NULL, .size = 0 };
 AVFrame *frame = NULL;
 AVDictionary *opt = NULL;
 AVStream *ost;

 av_register_all();
 avdevice_register_all();

 audio_input = argv[1];
 output = argv[2];

 //INPUT
 //Open input in selected format
 in_format = av_find_input_format("pulse");
 if((ret = avformat_open_input(&in_format_ctx, audio_input, in_format, NULL))!=0)
 {
 fprintf(stderr,"Could not open audio input: %s. %s\n",audio_input,av_err2str(ret));
 exit(1);
 }

 //Find stream info in header and display
 if((ret = avformat_find_stream_info(in_format_ctx, NULL))<0)
 {
 fprintf(stderr,"Could not find stream information. %s\n",av_err2str(ret));
 exit(1);
 }

 av_dump_format(in_format_ctx, 0, audio_input, 0);

 in_codec = avcodec_find_decoder(in_format_ctx->streams[0]->codec->codec_id);
 if(in_codec==NULL) {
 fprintf(stderr, "Unsupported decoder.\n");
 exit(1);
 }

 //Allocate memory for microphone input codec context (all information)
 in_codec_ctx = avcodec_alloc_context3(in_codec);
 if((ret = avcodec_copy_context(in_codec_ctx, in_format_ctx->streams[0]->codec)) != 0) {
 fprintf(stderr, "Couldn't copy codec context. %s\n",av_err2str(ret));
 exit(1);
 }

 //Use selected codec and codec context
 if((ret = avcodec_open2(in_codec_ctx, in_codec, NULL))<0)
 {
 fprintf(stderr, "Could not open audio codec. %s\n",av_err2str(ret));
 exit(1);
 }


 //OUTPUT
 ret = avformat_alloc_output_context2(&out_format_ctx, NULL, "rtsp", output);
 if (!out_format_ctx) {
 fprintf(stderr, "Output format ptoblem. %s\n",av_err2str(ret));
 exit(1);
 }

 out_format = out_format_ctx->oformat;
 /* open the output file, if needed */

 out_codec = avcodec_find_encoder(AV_CODEC_ID_OPUS);
 if(out_codec==NULL) {
 fprintf(stderr, "Unsupported encoder.\n");
 exit(1);
 }

 out_codec_ctx = avcodec_alloc_context3(out_codec);
 if (!out_codec_ctx) {
 fprintf(stderr, "Could not alloc an encoding context\n");
 exit(1);
 }

 /* check that the encoder supports s16 pcm input */
 out_codec_ctx->sample_fmt = AV_SAMPLE_FMT_S16;
 out_codec_ctx->bit_rate = 16000;
 out_codec_ctx->sample_rate = 8000;
 out_codec_ctx->channels = 1;
 out_codec_ctx->channel_layout = AV_CH_LAYOUT_MONO;
 out_codec_ctx->channels = av_get_channel_layout_nb_channels(out_codec_ctx->channel_layout);

 if (out_format_ctx->oformat->flags & AVFMT_GLOBALHEADER)
 out_codec_ctx->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;

 ret = avcodec_open2(out_codec_ctx, out_codec, NULL);
 if (ret < 0) {
 fprintf(stderr, "Could not open audio codec: %s\n", av_err2str(ret));
 exit(1);
 }

 ost = avformat_new_stream(out_format_ctx, NULL);
 if (!ost) {
 fprintf(stderr, "Could not allocate stream\n");
 exit(1);
 }
 ost->id=0;

 ret = avcodec_parameters_from_context(ost->codecpar, out_codec_ctx);
 if (ret < 0) {
 av_log(NULL, AV_LOG_ERROR, "Failed to copy encoder parameters to output stream. %s\n",av_err2str(ret));
 return ret;
 }

 ost->time_base = out_codec_ctx->time_base;

 av_dump_format(out_format_ctx, 0, output, 1);

 /* copy the stream parameters to the muxer */
 ret = avcodec_parameters_from_context(ost->codecpar, out_codec_ctx);
 if (ret < 0) {
 fprintf(stderr, "Could not copy the stream parameters. %s\n",av_err2str(ret));
 exit(1);
 }

 if (!(out_format_ctx->oformat->flags & AVFMT_NOFILE)) {
 ret = avio_open(&out_format_ctx->pb, output, AVIO_FLAG_WRITE);
 if (ret < 0) {
 av_log(NULL, AV_LOG_ERROR, "Could not open output file '%s'", output);
 return ret;
 }
 }

 /* init muxer, write output file header */
 ret = avformat_write_header(out_format_ctx, NULL);
 if (ret < 0) {
 av_log(NULL, AV_LOG_ERROR, "Error occurred when opening output file\n");
 return ret;
 }

 while(1)
 {
 if((ret = av_read_frame(in_format_ctx, &packet)) < 0)
 {
 fprintf(stderr, "Reading frame failed. %s\n",av_err2str(ret));
 break;
 }

 frame = av_frame_alloc();
 if (!frame) {
 ret = AVERROR(ENOMEM);
 break;
 }

 av_packet_rescale_ts(&packet,in_format_ctx->streams[0]->time_base,in_codec_ctx->time_base);

 if((ret = avcodec_decode_audio4(in_codec_ctx,frame,&got_frame,&packet)) < 0)
 {
 av_frame_free(&frame);
 fprintf(stderr, "Audio decoding failed. %s\n",av_err2str(ret));
 break;
 }

 frame->nb_samples = out_codec_ctx->frame_size;
 if((ret = av_frame_get_buffer(frame, 0))<0)
 {
 fprintf(stderr, "Error allocating an audio buffer. %s\n",av_err2str(ret));
 break;
 }

 if(got_frame)
 {
 if((ret = avcodec_encode_audio2(out_codec_ctx,&packet,frame,&got_packet)) < 0)
 {
 av_frame_free(&frame);
 fprintf(stderr, "Audio encoding failed. %d %s\n",ret,av_err2str(ret));
 break;
 }
 }
 av_frame_free(&frame);

 if(got_packet)
 {
 if((ret = av_interleaved_write_frame(out_format_ctx,&packet)) < 0)
 {
 av_packet_unref(&packet);
 fprintf(stderr, "Writing frame error. %s\n",av_err2str(ret));
 break;
 }
 }
 av_packet_unref(&packet);
 }
}




-
opencv dont receive camera stream
11 juillet 2022, par Ofek nourianI have a simple IP camera connected to a video encoder "barracuda haivision S-280E-SDI"
I can receive the camera feed just fine with vlc, using the folowing URL :




rtsp ://10.5.1.2:554




then, I tried to play the video with python and opencv, using the following code :


cap = cv2.VideoCapture('rtsp://10.5.1.2:554', cv2.CAP_FFMPEG)

while cap.isOpened():
 ret, frame = cap.read()
 cv2.imshow('frame', frame)
 if cv2.waitKey(1) == ord(1):
 break
cap.release()
cap.destroyALLWindows()



but I get Error message :




[rtsp @ 0000219d1e4e580] method SETUP failed : 500




why does it happen ? what can I do to fix it ?