
Recherche avancée
Médias (91)
-
#3 The Safest Place
16 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
-
#4 Emo Creates
15 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
-
#2 Typewriter Dance
15 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
-
#1 The Wires
11 octobre 2011, par
Mis à jour : Février 2013
Langue : English
Type : Audio
-
ED-ME-5 1-DVD
11 octobre 2011, par
Mis à jour : Octobre 2011
Langue : English
Type : Audio
-
Revolution of Open-source and film making towards open film making
6 octobre 2011, par
Mis à jour : Juillet 2013
Langue : English
Type : Texte
Autres articles (65)
-
Gestion des droits de création et d’édition des objets
8 février 2011, parPar défaut, beaucoup de fonctionnalités sont limitées aux administrateurs mais restent configurables indépendamment pour modifier leur statut minimal d’utilisation notamment : la rédaction de contenus sur le site modifiables dans la gestion des templates de formulaires ; l’ajout de notes aux articles ; l’ajout de légendes et d’annotations sur les images ;
-
Les tâches Cron régulières de la ferme
1er décembre 2010, parLa gestion de la ferme passe par l’exécution à intervalle régulier de plusieurs tâches répétitives dites Cron.
Le super Cron (gestion_mutu_super_cron)
Cette tâche, planifiée chaque minute, a pour simple effet d’appeler le Cron de l’ensemble des instances de la mutualisation régulièrement. Couplée avec un Cron système sur le site central de la mutualisation, cela permet de simplement générer des visites régulières sur les différents sites et éviter que les tâches des sites peu visités soient trop (...) -
Supporting all media types
13 avril 2011, parUnlike most software and media-sharing platforms, MediaSPIP aims to manage as many different media types as possible. The following are just a few examples from an ever-expanding list of supported formats : images : png, gif, jpg, bmp and more audio : MP3, Ogg, Wav and more video : AVI, MP4, OGV, mpg, mov, wmv and more text, code and other data : OpenOffice, Microsoft Office (Word, PowerPoint, Excel), web (html, CSS), LaTeX, Google Earth and (...)
Sur d’autres sites (11388)
-
Why when using ffmpeg to create in real time avi video file from images the avi file is playing with purple noisy color ?
30 juin 2015, par Brubaker HaimThis is my Ffmpeg class i did some time ago
using System;
using System.Windows.Forms;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Drawing;
using System.IO.Pipes;
using System.Runtime.InteropServices;
using System.Diagnostics;
using System.IO;
using DannyGeneral;
namespace Manager
{
class Ffmpeg
{
NamedPipeServerStream p;
String pipename = "mytestpipe";
System.Diagnostics.Process process;
string ffmpegFileName = "ffmpeg.exe";
string workingDirectory;
public Ffmpeg()
{
workingDirectory = Path.GetDirectoryName(Application.ExecutablePath);
Logger.Write("workingDirectory: " + workingDirectory);
if (!Directory.Exists(workingDirectory))
{
Directory.CreateDirectory(workingDirectory);
}
ffmpegFileName = Path.Combine(workingDirectory, ffmpegFileName);
Logger.Write("FfmpegFilename: " + ffmpegFileName);
}
public void Start(string pathFileName, int BitmapRate)
{
try
{
string outPath = pathFileName;
p = new NamedPipeServerStream(pipename, PipeDirection.Out, 1, PipeTransmissionMode.Byte);
ProcessStartInfo psi = new ProcessStartInfo();
psi.WindowStyle = ProcessWindowStyle.Hidden;
psi.UseShellExecute = false;
psi.CreateNoWindow = false;
psi.FileName = ffmpegFileName;
psi.WorkingDirectory = workingDirectory;
psi.Arguments = @"-f rawvideo -pix_fmt yuv420p -video_size 1920x1080 -i \\.\pipe\mytestpipe -map 0 -c:v mpeg4 -r " + BitmapRate + " " + outPath;
process = Process.Start(psi);
process.EnableRaisingEvents = false;
psi.RedirectStandardError = true;
p.WaitForConnection();
}
catch (Exception err)
{
Logger.Write("Exception Error: " + err.ToString());
}
}
public void PushFrame(Bitmap bmp)
{
try
{
int length;
// Lock the bitmap's bits.
//bmp = new Bitmap(1920, 1080);
Rectangle rect = new Rectangle(0, 0, bmp.Width, bmp.Height);
//Rectangle rect = new Rectangle(0, 0, 1280, 720);
System.Drawing.Imaging.BitmapData bmpData =
bmp.LockBits(rect, System.Drawing.Imaging.ImageLockMode.ReadOnly,
bmp.PixelFormat);
int absStride = Math.Abs(bmpData.Stride);
// Get the address of the first line.
IntPtr ptr = bmpData.Scan0;
// Declare an array to hold the bytes of the bitmap.
//length = 3 * bmp.Width * bmp.Height;
length = absStride * bmpData.Height;
byte[] rgbValues = new byte[length];
//Marshal.Copy(ptr, rgbValues, 0, length);
int j = bmp.Height - 1;
for (int i = 0; i < bmp.Height; i++)
{
IntPtr pointer = new IntPtr(bmpData.Scan0.ToInt32() + (bmpData.Stride * j));
System.Runtime.InteropServices.Marshal.Copy(pointer, rgbValues, absStride * (bmp.Height - i - 1), absStride);
j--;
}
p.Write(rgbValues, 0, length);
bmp.UnlockBits(bmpData);
}
catch(Exception err)
{
Logger.Write("Error: " + err.ToString());
}
}
public void Close()
{
p.Close();
}
}
}And i’m using it in form1 in a button click event :
private void button1_Click(object sender, EventArgs e)
{
timer1.Start();
}the directroy screenshots is where i’m taking a screenshot every 100ms in the timer1 tick event :
ScreenShot shot = new ScreenShot();
public static int counter = 0;
private void timer1_Tick(object sender, EventArgs e)
{
counter++;
shot.GetScreenShot(@"e:\screenshots\", "screenshot");
if (counter == 1200)
{
timer1.Stop();
}
}I’m calling the method PushFrame from inside the ScreenShot class where i save the screenshots.
Ffmpeg fmpeg;
Then :
fmpeg = new Ffmpeg();
fmpeg.Start(@"e:\screenshots\test.avi", 25);And :
public Bitmap GetScreenShot(string folder, string name)
{
_screenShot = new Bitmap(GetScreen());
System.GC.Collect();
System.GC.WaitForPendingFinalizers();
string ingName = folder + name + Elgato_Video_Capture.counter.ToString("D6") + ".bmp";
_screenShot.Save(ingName);
fmpeg.PushFrame(_screenShot);
_screenShot.Dispose();
return _screenShot;
}All the images on the hard disk are fine i can edit/open them and watch them no problems.
They are also same size.The result in the end is one big avi file 1.08 GB size.
But when i play it i see many windows running inside very fast and all painted with noisy purple color.Here a screenshot from the video file when playing it :
I think the problem is somewhere in the Ffmpeg class where i give parameters to the ffmpeg.exe
psi.Arguments = @"-f rawvideo -pix_fmt yuv420p -video_size 1920x1080 -i \\.\pipe\mytestpipe -map 0 -c:v mpeg4 -r " + BitmapRate + " " + outPath;
Not sure what make this avi file to look like that.
This is the video file the result i got : https://www.youtube.com/watch?v=fdxPus-Xv1k&feature=youtu.be
-
With ffmpeg, how can I combine a video stream with 2 audio streams, with only 1 of the audio streams playing at a specific time
5 juin 2023, par tiagosilvaI have a video and 2 audio streams, in 2 different languages (one live, the other a dubbed version, all streams have the same lenght).


I want to combine these into one final output, but I don't want to ever mix both. I want to tell ffmpeg to use audio stream 1 up to minute 10, and use audio stream 2 after that.


How can I achieve this ? I figure I might need amix, but that just mixes the audiostreams and makes them simultaneous, I only want one audio stream at a time.


Bonus points if it can be done without re-encoding


-
When decoding video with ffmpeg and playing the decoded audio data with SDL2, it's all noise [closed]
18 février, par jodan fengit is the code in the main thread


int main(int argc, char *argv[])
{
 QApplication a(argc, argv);
 Ffplay f;
 f.start();
 return a.exec();
}



Ffplay is the thread that decode the video and play it


class Ffplay : public QThread
{
 Q_OBJECT
public:
 Ffplay();
 protected:
 void run() override;
public:
 AVFormatContext* format2;
 Thread2 t2;
};
Ffplay::Ffplay() {}

void Ffplay::run(){
 format2=avformat_alloc_context();
 avformat_open_input(&format2,"c:/Qt/project/player/movie.mp4",NULL,NULL);
 avformat_find_stream_info(format2,NULL);
 t2.format=format2;
 t2.start();
}



Thread2 is the thread that decoed the audio part and play it


class Thread2 : public QThread
{
 Q_OBJECT
public:
 Thread2();
protected:
 void run() override;
public:
 AVFormatContext* format;
 AVCodecContext* codec;
 const AVCodec* c;
 AVPacket* packet;
 AVFrame* frame;
 SwrContext* s;
 FILE* f;
 FILE* f2;

};
Thread2::Thread2() {}

struct Sound
{
 Uint8* data;
 Uint32 position=0;
 Uint32 len;
};

Sound* d=new Sound;

void write(void* userdata,Uint8* stream,int len){
 SDL_memset(stream,0,len);
 int size2=std::min((Uint32)len,d->len-d->position);
 SDL_memcpy(stream,d->data+d->position,size2);
 d->position=d->position+size2;
}


void Thread2::run(){
 int index=-1;
 for(unsigned int i=0;inb_streams;i++){
 if(format->streams[i]->codecpar->codec_type==AVMEDIA_TYPE_AUDIO){
 index=i;
 break;
 }
 }
 c=avcodec_find_decoder(format->streams[index]->codecpar->codec_id);
 codec=avcodec_alloc_context3(c);
 avcodec_parameters_to_context(codec,format->streams[index]->codecpar);
 avcodec_open2(codec,c,NULL);
 packet=av_packet_alloc();
 frame=av_frame_alloc();
 s=swr_alloc();
 swr_alloc_set_opts2(&s,&codec->ch_layout,AV_SAMPLE_FMT_S16,codec->sample_rate,&codec->ch_layout,codec->sample_fmt,codec->sample_rate,0,NULL);
 swr_init(s);
 f=fopen("yinpin","wb");
 uint8_t* buff=(uint8_t*)av_malloc(2*1024*4); 
 while(av_read_frame(format,packet)==0){
 if(packet->stream_index==1){
 avcodec_send_packet(codec,packet);
 while(avcodec_receive_frame(codec,frame)>=0){
 swr_convert(s,&buff,2*1024*2*2,(const uint8_t **)frame->data,frame->nb_samples);
 int size=av_samples_get_buffer_size(NULL,2,frame->nb_samples,AV_SAMPLE_FMT_S16,1);
 fwrite(buff,1,size,f);
 }
 }
 }


 SDL_Init(SDL_INIT_AUDIO);
 SDL_AudioSpec spec;
 spec.freq=48000;
 spec.format=AUDIO_S16;
 spec.channels=2;
 spec.samples=1024;
 spec.callback=write;
 SDL_OpenAudio(&spec,NULL);
 SDL_PauseAudio(0);
 f2=fopen("yinpin","rb");
 uint8_t* buff2=(uint8_t*)av_malloc(2*2*1024*2);
 size_t size=10;
 while(size>0){
 size=fread(buff2,1,2*2*1024*2,f2);
 d->data=buff2;
 d->len=(Uint32)size;
 }
}



After the program is run, the sound played is all noise, which makes me a little confused because I don't know whether it is a decoding problem or a problem with SDL2 audio playback. Is there any troubleshooting method ? Has anyone figured out the source of the problem ?