
Recherche avancée
Autres articles (66)
-
Personnaliser en ajoutant son logo, sa bannière ou son image de fond
5 septembre 2013, parCertains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;
-
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 -
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.
Sur d’autres sites (5227)
-
Decoding with FFMPEG on Visual Studio 2010
6 juin 2013, par user2439801I just started using FFMPEG with C++ and try to code an audio decoder then write the decoded audio into a file.
However i'm not sure about which data to write to the output file. As far as i know from looking at the sample codes it seems to be the AVFrame -> data[0].
But when i try to print it on the consoles, i get some random numbers that are different each time i run the program. And when i try to write this AVFrame->data[0] into a file i keep getting an error.So my question is how can i write the decoded audio after i call the function av_codec_decode_audio4 ?
Below i attached my code and i pass the argument "C :\02.mp3" which is a path for a valid mp3 file on my PC.
Thank you for your help.
// TestFFMPEG.cpp : Audio Decoder
//
#include "stdafx.h"
#include <iostream>
#include <fstream>
#include <sstream>
extern "C" {
#include
#include
#include
}
using namespace std;
int main(int argc, char* argv[])
{
int audioStream = -1;
AVCodec *aCodec;
AVPacket avPkt;
AVFrame *decode_frame = avcodec_alloc_frame();
AVCodecContext *aCodecCtxt;
AVFormatContext *pFormatCtxt = NULL;
if(argc != 2) { // Checking whether there is enough argument
return -1;
}
av_register_all(); //Initialize CODEC
avformat_network_init();
av_init_packet (&avPkt);
if (avformat_open_input (&pFormatCtxt, argv[1],NULL,NULL)!= 0 ){ //Opening File
return -2;
}
if(avformat_find_stream_info (pFormatCtxt,NULL) < 0){ //Get Streams Info
return -3;
}
AVStream *stream = NULL;
//av_read_play (pFormatCtxt); //open streams
for (int i = 0; i < pFormatCtxt->nb_streams ; i++) { //Find Audio Stream
if (pFormatCtxt->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO){
audioStream =i;
}
}
aCodecCtxt = pFormatCtxt ->streams [audioStream]->codec; // opening decoder
aCodec = avcodec_find_decoder( pFormatCtxt->streams [audioStream] ->codec->codec_id);
if (!aCodec) {
return -8;
}
if (avcodec_open2(aCodecCtxt,aCodec,NULL)!=0) {
return -9;
}
int cnt = 0;
while(av_read_frame(pFormatCtxt,&avPkt) >= 0 ){
if (avPkt.stream_index == audioStream){
int check = 0;
int result = avcodec_decode_audio4 (aCodecCtxt,decode_frame,&check, &avPkt);
cout << "Decoded : "<< (int) decode_frame->data[0] <<", "<< "Check : " << check << ", Format :" << decode_frame->format <<" " << decode_frame->linesize[0]<< " "<<cnt return="return" acodec="acodec">id;
}
</cnt></sstream></fstream></iostream> -
Using FFMPEG and Open CV and encoding webcam stream to h264 in VC 2010
22 novembre 2013, par OsaidI am trying to capture video stream and at the same time willing to encode it to h264 and save it to a file. I am using OpenCV to capture stream but am having problem converting them to h264 via FFMPEG. OS is WINDOWS XP and VC 2010 is the environment.
I referred the encoding_decoding (refer video encoding section) provided by the FFMPEG. FFMPEG uses AVFrame i.e.
AVFrame *frame;
structure in which there is image data at frame->data but in OpenCV I am capturing frames in
Mat WebCamFrame;
cap >> WebCamFrame; //Captures frame from webcam and puts it to WebCamFrameFor encoding I have to get this captured WebCamFrame to frame->data then encode it using the
avcodec_encode_video2(c, &pkt, frame, &got_output);
in the encoding_decoding example a dummy image is created as
/* prepare a dummy image */
/* Y */
for(y=0;yheight;y++)
{
for(x=0;xwidth;x++)
{
frame->data[0][y * frame->linesize[0] + x] = x + y + i * 3;
}
}
/* Cb and Cr */
for(y=0;yheight/2;y++)
{
for(x=0;xwidth/2;x++)
{
frame->data[1][y * frame->linesize[1] + x] = 128 + y + i * 2;
frame->data[2][y * frame->linesize[2] + x] = 64 + x + i * 5;
}
}I do not want to use this dummy image rather the frame captured from webcam to encode it to h264. One more thing, the data type of WebCamFrame is MAT and that of frame is AVFrame. I would really appreciate a hint to proceed further. In a nutshell I want to process Mat frames (webCam video Stream) of OpenCV in FFMPEG avcodec_encode_video2() and write the video to a file.
-
OpenCV 2.4.7 with FFMpeg support build with VS 2010 (x86)
24 novembre 2013, par GregPhilI'm fighting with new version of OpenCV 2.4.7 for almost one week (prev. used 2.4.2). My motivation for the new setup is the fact that I run into problems using the Videowriter for uncompressed grayscale videos (http://answers.opencv.org/question/3603/videowriter-videocapture-and-uncompressed-avi/). In https://github.com/Itseez/opencv/pull/1516 "akarsakov" is recommending to build OpenCV without vfw support and open uncompressed video through ffmpeg. That's what I tried to do. I followed basically the instructions mentioned in this video : http://docs.opencv.org/trunk/doc/tutorials/introduction/windows_install/windows_install.html
I had successfully build opencv with Qt 5.1.1 (http://answers.opencv.org/question/24184/how-to-compile-opencv-247-with-qt-and-ffmpeg/). But I'm not able to get the VideoWriter & VideoCapture work for me. So what I did :
-
I downloaded the newest ffmpeg build from http://ffmpeg.zeranoe.com/builds/
-
I generated the vs2010 project disabling VfW and enabling ffmpeg instead :
Video I/O:
Video for Windows: NO
DC1394 1.x: NO
DC1394 2.x: NO
FFMPEG: YES (prebuilt binaries)
codec: YES (ver 55.18.102)
format: YES (ver 55.12.100)
util: YES (ver 52.38.100)
swscale: YES (ver 2.3.100)
gentoo-style: YES
OpenNI: NO
OpenNI PrimeSensor Modules: NO
PvAPI: NO
GigEVisionSDK: NO
DirectShow: YES
Media Foundation: NO
XIMEA: NO -
I added the include directories and libs for ffmpeg to the highgui module.
I was not able to compile OpenCV without any errors but the behaviour what I see is not what I expect :
- Build OpenCV 2.4.7 without VfW -> VideoWriter.open () returns always false !
- Build OpenCV 2.4.7 with VfW -> VideoWriter.open () returns true for the time, calling a release() and an open() on the same object returns always a false.
- With or without ffmpeg -> An VideoCapture.open () gives a error message asking for libiconv-2dll !
Does some had the same problems and is able to point me to my mistake ?
Thank you in advance.
cheers -