
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 (18)
-
MediaSPIP Core : La Configuration
9 novembre 2010, parMediaSPIP Core fournit par défaut trois pages différentes de configuration (ces pages utilisent le plugin de configuration CFG pour fonctionner) : une page spécifique à la configuration générale du squelettes ; une page spécifique à la configuration de la page d’accueil du site ; une page spécifique à la configuration des secteurs ;
Il fournit également une page supplémentaire qui n’apparait que lorsque certains plugins sont activés permettant de contrôler l’affichage et les fonctionnalités spécifiques (...) -
Les statuts des instances de mutualisation
13 mars 2010, parPour des raisons de compatibilité générale du plugin de gestion de mutualisations avec les fonctions originales de SPIP, les statuts des instances sont les mêmes que pour tout autre objets (articles...), seuls leurs noms dans l’interface change quelque peu.
Les différents statuts possibles sont : prepa (demandé) qui correspond à une instance demandée par un utilisateur. Si le site a déjà été créé par le passé, il est passé en mode désactivé. publie (validé) qui correspond à une instance validée par un (...) -
MediaSPIP Player : problèmes potentiels
22 février 2011, parLe lecteur ne fonctionne pas sur Internet Explorer
Sur Internet Explorer (8 et 7 au moins), le plugin utilise le lecteur Flash flowplayer pour lire vidéos et son. Si le lecteur ne semble pas fonctionner, cela peut venir de la configuration du mod_deflate d’Apache.
Si dans la configuration de ce module Apache vous avez une ligne qui ressemble à la suivante, essayez de la supprimer ou de la commenter pour voir si le lecteur fonctionne correctement : /** * GeSHi (C) 2004 - 2007 Nigel McNie, (...)
Sur d’autres sites (4725)
-
Audio offset get wrong after some time when streaming audios
7 septembre 2024, par Antoine GrenardI use microsoft-cognitiveservices-speech-sdk (1.38.0) in order to do real time speech to text.
It seems like the offset is right when I send a full audio but it is wrong when I send it cut in a lot of audio chunks.


The more there is audio chunks the more inaccurate the offset is :


- 

- No chunks : 1 726 300 000
- 369 chunks of 0.5 seconds : 1 729 600 000
- 923 chunks of 0.2 seconds : 1 744 600 000
- 1443 chunks of 0.1 seconds : 1 757 900 000










To reproduce here is some piece of code :


const speechConfig = SpeechConfig.fromSubscription(<key>, {console.log(event)}
 speechRecognizer.canceled = async (recognizer, event) => {console.log(event)}
 speechRecognizer.startContinuousRecognitionAsync();

 for (let i = 1; i <= 1443; i++) {
 const formattedNumber = i.toString().padStart(4, '0');
 const buffer = fs.readFileSync(`/var/tmp/chunks/output_${formattedNumber}.wav`);
 pushStream.write(buffer);
 }
</key>


To create the audio chunks :


ffmpeg -i -f segment -segment_time 0.1 -c copy output_%04d.wav



Here is the audio link : https://drive.google.com/file/d/1H_RJuqMiBaVkpo9XHrgp1bpuFdgQl64O/view?usp=sharing


Thanks for your help


-
I am using ffmpeg java library to convert captured screenshots to video. Video output is blurry
2 octobre 2020, par dark princeI am using ffmpeg java library to convert captured screenshots to video. Video which is generated as output is blurry.


I am using bit rate as 9000, frames per sec as 25 and video size as that of desktop screen size.


Any suggestions on how to solve this issue.


P.S. I cannot use ffmpeg.exe and command line due to certain restrictions and hence I am opting for ffmpeg java library.


Any suggestions on the issue or suggestions on any better approach will be helpful.


import java.awt.AWTException;
 import java.awt.Dimension;
 import java.awt.FlowLayout;
 import java.awt.Rectangle;
 import java.awt.Robot;
 import java.awt.Toolkit;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.awt.image.BufferedImage;
 import java.io.File;
 import java.io.IOException;
 import java.util.Date;
 
 import javax.imageio.ImageIO;
 import javax.swing.JButton;
 import javax.swing.JFrame;
 import javax.swing.JLabel;
 import javax.swing.JOptionPane;
 
 import org.bytedeco.javacpp.avcodec;
 import org.bytedeco.javacv.FFmpegFrameRecorder;
 import org.bytedeco.javacv.OpenCVFrameConverter;
 
 public class ScreenRecorder{
 
 public static boolean videoComplete=false;
 public static String inputImageDir="inputImgFolder"+File.separator;
 public static String inputImgExt="png";
 public static String outputVideo="recording.mp4"; 
 public static int counter=0;
 public static int imgProcessed=0;
 public static FFmpegFrameRecorder recorder=null;
 public static int videoWidth=1920;
 public static int videoHeight=1080;
 public static int videoFrameRate=3;
 public static int videoQuality=0; // 0 is the max quality
 public static int videoBitRate=9000;
 public static String videoFormat="mp4";
 public static int videoCodec=avcodec.AV_CODEC_ID_MPEG4;
 public static Thread t1=null;
 public static Thread t2=null;
 public static JFrame frame=null;
 public static boolean isRegionSelected=false;
 public static int c1=0;
 public static int c2=0;
 public static int c3=0;
 public static int c4=0;
 
 
 public static void main(String[] args) {
 
 try {
 if(getRecorder()==null)
 {
 System.out.println("Cannot make recorder object, Exiting program");
 System.exit(0);
 }
 if(getRobot()==null)
 {
 System.out.println("Cannot make robot object, Exiting program");
 System.exit(0);
 }
 File scanFolder=new File(inputImageDir);
 scanFolder.delete();
 scanFolder.mkdirs();
 
 createGUI();
 } catch (Exception e) {
 System.out.println("Exception in program "+e.getMessage());
 }
 }
 
 public static void createGUI()
 {
 frame=new JFrame("Screen Recorder");
 JButton b1=new JButton("Select Region for Recording");
 JButton b2=new JButton("Start Recording");
 JButton b3=new JButton("Stop Recording");
 JLabel l1=new JLabel("<br />If you dont select a region then full screen recording <br /> will be made when you click on Start Recording");
 l1.setFont (l1.getFont ().deriveFont (20.0f));
 b1.addActionListener(new ActionListener() {
 @Override
 public void actionPerformed(ActionEvent e) {
 try {
 JOptionPane.showMessageDialog(frame, "A new window will open. Use your mouse to select the region you like to record");
 new CropRegion().getImage();
 } catch (Exception e1) {
 // TODO Auto-generated catch block
 System.out.println("Issue while trying to call the module to crop region");
 e1.printStackTrace();
 } 
 }
 });
 b2.addActionListener(new ActionListener() {
 @Override
 public void actionPerformed(ActionEvent e) {
 counter=0;
 startRecording();
 }
 });
 b3.addActionListener(new ActionListener() {
 @Override
 public void actionPerformed(ActionEvent e) {
 stopRecording();
 System.out.print("Exiting...");
 System.exit(0);
 }
 });
 
 frame.add(b1);
 frame.add(b2);
 frame.add(b3);
 frame.add(l1);
 frame.setLayout(new FlowLayout(0));
 frame.setVisible(true);
 frame.setSize(1000, 170);
 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
 }
 
 public static void startRecording()
 {
 t1=new Thread()
 {
 public void run() {
 try {
 takeScreenshot(getRobot());
 } catch (Exception e) {
 JOptionPane.showMessageDialog(frame, "Cannot make robot object, Exiting program "+e.getMessage());
 System.out.println("Cannot make robot object, Exiting program "+e.getMessage());
 System.exit(0);
 }
 }
 };
 
 t2=new Thread()
 {
 public void run() {
 prepareVideo();
 }
 };
 
 t1.start();
 t2.start();
 System.out.println("Started recording at "+new Date());
 }
 
 public static Robot getRobot() throws Exception
 {
 Robot r=null;
 try {
 r = new Robot();
 return r;
 } catch (AWTException e) {
 JOptionPane.showMessageDialog(frame, "Issue while initiating Robot object "+e.getMessage());
 System.out.println("Issue while initiating Robot object "+e.getMessage());
 throw new Exception("Issue while initiating Robot object");
 }
 }
 
 public static void takeScreenshot(Robot r)
 {
 Dimension size = Toolkit.getDefaultToolkit().getScreenSize();
 Rectangle rec=new Rectangle(size);
 if(isRegionSelected)
 {
 rec=new Rectangle(c1, c2, c3-c1, c4-c2);
 }
 while(!videoComplete)
 {
 counter++;
 BufferedImage img = r.createScreenCapture(rec);
 try {
 ImageIO.write(img, inputImgExt, new File(inputImageDir+counter+"."+inputImgExt));
 } catch (IOException e) {
 JOptionPane.showMessageDialog(frame, "Got an issue while writing the screenshot to disk "+e.getMessage());
 System.out.println("Got an issue while writing the screenshot to disk "+e.getMessage());
 counter--;
 }
 }
 }
 
 public static void prepareVideo()
 {
 File scanFolder=new File(inputImageDir);
 while(!videoComplete)
 {
 File[] inputFiles=scanFolder.listFiles();
 try {
 getRobot().delay(500);
 } catch (Exception e) {
 }
 //for(int i=0;i/imgProcessed++;
 addImageToVideo(inputFiles[i].getAbsolutePath());
 //String imgToAdd=scanFolder.getAbsolutePath()+File.separator+imgProcessed+"."+inputImgExt;
 //addImageToVideo(imgToAdd);
 //new File(imgToAdd).delete();
 inputFiles[i].delete();
 }
 }
 
 File[] inputFiles=scanFolder.listFiles();
 for(int i=0;i/ maximum quality
 recorder.start();
 }
 catch(Exception e)
 {
 JOptionPane.showMessageDialog(frame, "Exception while starting the recorder object "+e.getMessage());
 System.out.println("Exception while starting the recorder object "+e.getMessage());
 throw new Exception("Unable to start recorder");
 }
 return recorder;
 }
 
 public static OpenCVFrameConverter.ToIplImage getFrameConverter()
 {
 OpenCVFrameConverter.ToIplImage grabberConverter = new OpenCVFrameConverter.ToIplImage();
 return grabberConverter;
 }
 
 public static void addImageToVideo(String imgPath)
 {
 try {
 getRecorder().record(getFrameConverter().convert(cvLoadImage(imgPath)));
 } catch (Exception e) {
 JOptionPane.showMessageDialog(frame, "Exception while adding image to video "+e.getMessage());
 System.out.println("Exception while adding image to video "+e.getMessage());
 }
 }
 
 public static void stopRecording()
 {
 try {
 videoComplete=true;
 System.out.println("Stopping recording at "+new Date());
 t1.join();
 System.out.println("Screenshot thread complete");
 t2.join();
 System.out.println("Video maker thread complete");
 getRecorder().stop();
 System.out.println("Recording has been saved successfully at "+new File(outputVideo).getAbsolutePath());
 JOptionPane.showMessageDialog(frame, "Recording has been saved successfully at "+new File(outputVideo).getAbsolutePath());
 } catch (Exception e) {
 System.out.println("Exception while stopping the recorder "+e.getMessage());
 }
 }
 }



Imagepanel.java


import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Image;
import javax.swing.ImageIcon;
import javax.swing.JPanel;

class ImagePanel
 extends JPanel
{
 private Image img;
 
 public ImagePanel(String img)
 {
 this(new ImageIcon(img).getImage());
 }
 
 public ImagePanel(Image img)
 {
 this.img = img;
 Dimension size = new Dimension(img.getWidth(null), img.getHeight(null));
 
 setPreferredSize(size);
 setMinimumSize(size);
 setMaximumSize(size);
 setSize(size);
 setLayout(null);
 }
 
 public void paintComponent(Graphics g)
 {
 g.drawImage(this.img, 0, 0, null);
 }
}



CropRegion.java


import java.awt.AWTException;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.awt.image.BufferedImage;
import java.io.IOException;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;


public class CropRegion implements MouseListener,
 MouseMotionListener {

 int drag_status = 0;
 int c1;
 int c2;
 int c3;
 int c4;
 JFrame frame=null;
 static int counter=0;
 JLabel background=null;

 
 public void getImage() throws AWTException, IOException, InterruptedException {
 Dimension size = Toolkit.getDefaultToolkit().getScreenSize();
 Robot robot = new Robot();
 BufferedImage img = robot.createScreenCapture(new Rectangle(size));
 ImagePanel panel = new ImagePanel(img);
 frame=new JFrame();
 frame.add(panel);
 frame.setLocation(0, 0);
 frame.setSize(size);
 frame.setLayout(new FlowLayout());
 frame.setUndecorated(true);
 frame.setVisible(true);
 frame.addMouseListener(this);
 frame.addMouseMotionListener(this);
 frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
 }

 public void draggedScreen() throws Exception {
 ScreenRecorder.c1=c1;
 ScreenRecorder.c2=c2;
 ScreenRecorder.c3=c3;
 ScreenRecorder.c4=c4;
 ScreenRecorder.isRegionSelected=true;
 JOptionPane.showMessageDialog(frame, "Region Selected.Please click on Start Recording button to record the selected region.");
 frame.dispose();
 }

 public void mouseClicked(MouseEvent arg0) {
 }

 public void mouseEntered(MouseEvent arg0) {
 }

 public void mouseExited(MouseEvent arg0) {
 }

 public void mousePressed(MouseEvent arg0) {
 paint();
 this.c1 = arg0.getX();
 this.c2 = arg0.getY();
 }

 public void mouseReleased(MouseEvent arg0) {
 paint();
 if (this.drag_status == 1) {
 this.c3 = arg0.getX();
 this.c4 = arg0.getY();
 try {
 draggedScreen();
 } catch (Exception e) {
 e.printStackTrace();
 }
 }
 }

 public void mouseDragged(MouseEvent arg0) {
 paint();
 this.drag_status = 1;
 this.c3 = arg0.getX();
 this.c4 = arg0.getY();
 }

 public void mouseMoved(MouseEvent arg0) {
 }

 public void paint() {
 Graphics g = frame.getGraphics();
 frame.repaint();
 int w = this.c1 - this.c3;
 int h = this.c2 - this.c4;
 w *= -1;
 h *= -1;
 if (w < 0) {
 w *= -1;
 }
 g.drawRect(this.c1, this.c2, w, h);
 }
}



-
Recording with libx264 results in audio muting prior to recording being stopped depending on preset
24 janvier 2020, par Pyonffmpeg -thread_queue_size 512 -f dshow -i audio="AudioDevice" -thread_queue_size 512 -f gdigrab -rtbufsize 100000000 -hwaccel auto -framerate 60 -offset_x 332 -offset_y 720 -video_size 340x162 -probesize 10000000 -i desktop -c:v libx264 -preset veryslow -crf 23 -pix_fmt yuv420p "output.mp4"
I’m using the above command to record desktop video/audio in a defined region.
The video is being recorded using gdigrab while the audio is being recorded using dshow with a custom loopback driver.When the libx264 preset is set to anything below "ultrafast" like "veryslow", the audio will be muted around 80% into the recording (varies depending on video size and the preset selected, worsening for slower presets). By muted I mean : If I record a 10 second video, the video will be 10 seconds in length but the audio will only be audible for the first 8 seconds.
I’m not really sure what could be causing this, but is there any way around it ?
Below are simplified versions which produces same results..
Veryslow preset (audio issue) :
ffmpeg -thread_queue_size 512 -f dshow -i audio="PriAudio" -thread_queue_size 512 -f gdigrab -i desktop -c:v libx264 -preset veryslow -crf 23 -pix_fmt yuv420p "output.mp4"
Ultrafast preset (no audio issue) :
ffmpeg -thread_queue_size 512 -f dshow -i audio="PriAudio" -thread_queue_size 512 -f gdigrab -i desktop -c:v libx264 -preset ultrafast -crf 23 -pix_fmt yuv420p "output.mp4"
I don’t want to use ultrafast because it results in poor quality/compression ratio.