
Recherche avancée
Autres articles (59)
-
Le plugin : Podcasts.
14 juillet 2010, parLe problème du podcasting est à nouveau un problème révélateur de la normalisation des transports de données sur Internet.
Deux formats intéressants existent : Celui développé par Apple, très axé sur l’utilisation d’iTunes dont la SPEC est ici ; Le format "Media RSS Module" qui est plus "libre" notamment soutenu par Yahoo et le logiciel Miro ;
Types de fichiers supportés dans les flux
Le format d’Apple n’autorise que les formats suivants dans ses flux : .mp3 audio/mpeg .m4a audio/x-m4a .mp4 (...) -
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 -
Librairies et logiciels spécifiques aux médias
10 décembre 2010, parPour un fonctionnement correct et optimal, plusieurs choses sont à prendre en considération.
Il est important, après avoir installé apache2, mysql et php5, d’installer d’autres logiciels nécessaires dont les installations sont décrites dans les liens afférants. Un ensemble de librairies multimedias (x264, libtheora, libvpx) utilisées pour l’encodage et le décodage des vidéos et sons afin de supporter le plus grand nombre de fichiers possibles. Cf. : ce tutoriel ; FFMpeg avec le maximum de décodeurs et (...)
Sur d’autres sites (4942)
-
ffmpeg unbale to initialize threading [closed]
16 octobre 2020, par Sudipta RoyI have a JAVA service running in wildfly which is calling an external ffmpeg binary to convert .au files to .wav files. The actual command that is being executed is as follows :


ffmpeg -y -i INPUT.au OUTPUT.wav



It is running smoothly, except every once in a while it is creating an empty .wav file becasue of the following error :


Error: ffmpeg version c6710aa Copyright (c) 2000-2017 the FFmpeg 
developers
built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.4) 20160609
configuration: --prefix=/tmp/ffmpeg-static/target --pkg-config-flags=- 
-static --extra-cflags=-I/tmp/ffmpeg-static/target/include --extra- 
ldflags=-L/tmp/ffmpeg-static/target/lib --extra-ldexeflags=-static -- 
bindir=/tmp/ffmpeg-static/bin --enable-pic --enable-ffplay --enable- 
ffserver --enable-fontconfig --enable-frei0r --enable-gpl --enable- 
version3 --enable-libass --enable-libfribidi --enable-libfdk-aac -- 
enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb -- 
enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus -- 
enable-librtmp --enable-libsoxr --enable-libspeex --enable-libtheora - 
-enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis -- 
enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 -- 
enable-libxvid --enable-libzimg --enable-nonfree --enable-openssl
libavutil 55. 34.101 / 55. 34.101
libavcodec 57. 64.101 / 57. 64.101
libavformat 57. 56.101 / 57. 56.101
libavdevice 57. 1.100 / 57. 1.100
libavfilter 6. 65.100 / 6. 65.100
libswscale 4. 2.100 / 4. 2.100
libswresample 2. 3.100 / 2. 3.100
libpostproc 54. 1.100 / 54. 1.100

Input #0, ogg, from 'INPUT.au'
Duration: 00:00:34.08, start: 0.01500, bitrate: 15kb/s
Stream: #0.0: Audio: speex, 8000Hz, mono, s16, 15kb/s

[AVFilterGraph @ 0x43ec6e0] Error initializing threading.
[AVFilterGraph @ 0x43ec6e0] Error creating filter 'anull'



If I try to manually convert the file from command line, it works. A brief internet search (this) shows that it might be due to the fact that
ffmpeg
is unable to create threads for internal use. Can anyone please elaborate ?

The server where I am facing the problem have relatively high load. I have seen that wildfly is creating close to 1800 threads.


Thanks


P.s. I have managed to recreate the problem. Below is the code :


SystemCommandExecutor.java


import java.io.*;
 import java.util.List;
 public class SystemCommandExecutor {
 private List<string> commandInformation;
 private String adminPassword;
 private ThreadedStreamHandler inputStreamHandler;
 private ThreadedStreamHandler errorStreamHandler;

 public SystemCommandExecutor(final List<string> commandInformation)
 {
 if (commandInformation==null) throw new NullPointerException("The commandInformation is required.");
 this.commandInformation = commandInformation;
 this.adminPassword = null;
 }

 public int executeCommand()
 throws IOException, InterruptedException
 {
 int exitValue = -99;

 try
 {
 ProcessBuilder pb = new ProcessBuilder(commandInformation);
 Process process = pb.start();
 OutputStream stdOutput = process.getOutputStream();
 InputStream inputStream = process.getInputStream();
 InputStream errorStream = process.getErrorStream();
 inputStreamHandler = new ThreadedStreamHandler(inputStream, stdOutput, adminPassword);
 errorStreamHandler = new ThreadedStreamHandler(errorStream);
 inputStreamHandler.start();
 errorStreamHandler.start();
 exitValue = process.waitFor();
 inputStreamHandler.interrupt();
 errorStreamHandler.interrupt();
 inputStreamHandler.join();
 errorStreamHandler.join();
 }
 catch (IOException e)
 {
 throw e;
 }
 catch (InterruptedException e)
 {
 throw e;
 }
 finally
 {
 return exitValue;
 }
 }

 public StringBuilder getStandardOutputFromCommand()
 {
 return inputStreamHandler.getOutputBuffer();
 }

 public StringBuilder getStandardErrorFromCommand()
 {
 return errorStreamHandler.getOutputBuffer();
 }
}
</string></string>


ThreadedStreamHandler.java


import java.io.*;

class ThreadedStreamHandler extends Thread
{
 InputStream inputStream;
 String adminPassword;
 OutputStream outputStream;
 PrintWriter printWriter;
 StringBuilder outputBuffer = new StringBuilder();
 private boolean sudoIsRequested = false;

 
 ThreadedStreamHandler(InputStream inputStream)
 {
 this.inputStream = inputStream;
 }

 
 ThreadedStreamHandler(InputStream inputStream, OutputStream outputStream, String adminPassword)
 {
 this.inputStream = inputStream;
 this.outputStream = outputStream;
 this.printWriter = new PrintWriter(outputStream);
 this.adminPassword = adminPassword;
 this.sudoIsRequested = true;
 }

 public void run()
 {
 
 if (sudoIsRequested)
 {
 printWriter.println(adminPassword);
 printWriter.flush();
 }

 BufferedReader bufferedReader = null;
 try
 {
 bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
 String line = null;
 while ((line = bufferedReader.readLine()) != null)
 {
 outputBuffer.append(line + "\n");
 }
 }
 catch (IOException ioe)
 {
 ioe.printStackTrace();
 }
 catch (Throwable t)
 {
 t.printStackTrace();
 }
 finally
 {
 try
 {
 bufferedReader.close();
 }
 catch (IOException e)
 {
 // ignore this one
 }
 }
 }

 private void doSleep(long millis)
 {
 try
 {
 Thread.sleep(millis);
 }
 catch (InterruptedException e)
 {
 // ignore
 }
 }

 public StringBuilder getOutputBuffer()
 {
 return outputBuffer;
 }

}



FfmpegRunnable.java


import java.io.IOException;
import java.util.List;

public class FfmpegRunnable implements Runnable {
 private List<string> command;
 SystemCommandExecutor executor;

 public FfmpegRunnable(List<string> command) {
 this.command = command;
 this.executor = new SystemCommandExecutor(command);
 }

 @Override
 public void run() {
 try {
 int id = (int) Thread.currentThread().getId();
 int result = executor.executeCommand();
 if(result != 0) {
 StringBuilder err = executor.getStandardErrorFromCommand();
 System.out.println("[" + id + "]" + "[ERROR] " + err);
 } else {
 System.out.println("[" + id + "]" + "[SUCCESS]");
 }
 } catch (IOException e) {
 e.printStackTrace();
 } catch (InterruptedException e) {
 e.printStackTrace();
 }
 }
}
</string></string>


FfmpegMain.java


import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;
public class FfmpegMain {
 public static void main(String[] args) {
 //boolean threading = false;
 System.out.println(args[0]);
 int nrThread = Integer.parseInt(args[0]);
 boolean threading = Boolean.parseBoolean(args[1]);
 System.out.println("nrThread : " + nrThread + ", threading : " + threading);
 if(threading) {
 System.out.println("ffmpeg threading enabled");
 } else {
 System.out.println("ffmpeg threading not enabled");
 }
 ThreadPoolExecutor executor = (ThreadPoolExecutor) Executors.newFixedThreadPool(nrThread);
 for(int i=0; i cmd = new ArrayList<string>();
 String dest = "/tmp/OUTPUT/output_" + (Math.random()*1000) + ".wav";
 String cmdStr = "/tmp/FFMPEG/ffmpeg" + (threading ? " -threads 1 " : " ")
 + "-y -i /tmp/input.au " + dest;
 cmd.add("/bin/sh");
 cmd.add("-c");
 cmd.add(cmdStr);

 executor.submit(new FfmpegRunnable(cmd));
 }
 executor.shutdown();
 }
}
</string>


I have created a jar with the class files and run the jar from two seperate terminal with the following command


java -jar JAR.jar 40 true



Here 40 is the number of threads, simulating varous users accessing the system. Every once in a while I get above mentioned error.


-
How to overlay 2 videos, one is main second one is overlaying it, and play sound simultaneously. using FFMPEG in ANDROID STUDIO
6 août 2020, par Dusan Lilicas title say I'm trying to overlay 2 videos and play sound simultaneously. So far i managed to put 1 video over another using this command :


String[] command = {"-i", mainVideoPath, "-vf",
 "movie=" + overlayVideo + ", scale=300:-1[inner]; [in][inner]overlay=10:10[out]" ,combinedVideoOutput};



and this works but I have 3 problems here.
First, video is rotated by 90 degrees (overlay video), second Audio is played only from main video (I want to play sound from both videos simultaneously), and third overlay video is longer (for example : overlayVideo duration is 10 seconds and main video last 7 seconds) then mainVideo, so i want to final video last as long as mainVideo, as soon as mainVideo finish, overlayVideo should also stop (need to cut it prolly ?)


String[] command = {"-i", mainVideoPath, "-i", overlayVideo ,
 "-filter_complex", "[1:v][0:v]scale2ref=(256/256)*ih/8/sar:ih/8[wm][base];[base][wm]overlay=10:10" ,combinedVideoOutput};



Using this command i have 2 problems same as above except video is not rotated here.
I have to say that I'm not very familiar with ffmpeg commands. I was trying to figure it out from documentation link to documentation but without any success.
I know that I'm missing some filters like -map merge or something but can't figure it out.
Thanks in advance !


EDIT1 :
This is logcat from second commad as asked


D/LISKO: ffmpeg version n4.0-39-gda39990 Copyright (c) 2000-2018 the FFmpeg developers
 built with gcc 4.9.x (GCC) 20150123 (prerelease)
D/LISKO: configuration: --target-os=linux --cross-prefix=/root/bravobit/ffmpeg-android/toolchain-android/bin/arm-linux-androideabi- --arch=arm --cpu=cortex-a8 --enable-runtime-cpudetect --sysroot=/root/bravobit/ffmpeg-android/toolchain-android/sysroot --enable-pic --enable-libx264 --enable-ffprobe --enable-libopus --enable-libvorbis --enable-libfdk-aac --enable-libfreetype --enable-libfribidi --enable-libmp3lame --enable-fontconfig --enable-libvpx --enable-libass --enable-yasm --enable-pthreads --disable-debug --enable-version3 --enable-hardcoded-tables --disable-ffplay --disable-linux-perf --disable-doc --disable-shared --enable-static --enable-runtime-cpudetect --enable-nonfree --enable-network --enable-avresample --enable-avformat --enable-avcodec --enable-indev=lavfi --enable-hwaccels --enable-ffmpeg --enable-zlib --enable-gpl --enable-small --enable-nonfree --pkg-config=pkg-config --pkg-config-flags=--static --prefix=/root/bravobit/ffmpeg-android/build/armeabi-v7a --extra-cflags='-I/root/bravobit/ffmpeg-android/toolchain-android/include -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -fno-strict-overflow -fstack-protector-all' --extra-ldflags='-L/root/bravobit/ffmpeg-android/toolchain-android/lib -Wl,-z,relro -Wl,-z,now -pie' --extra-cxxflags=
D/LISKO: libavutil 56. 14.100 / 56. 14.100
 libavcodec 58. 18.100 / 58. 18.100
 libavformat 58. 12.100 / 58. 12.100
 libavdevice 58. 3.100 / 58. 3.100
 libavfilter 7. 16.100 / 7. 16.100
D/LISKO: libavresample 4. 0. 0 / 4. 0. 0
 libswscale 5. 1.100 / 5. 1.100
D/LISKO: libswresample 3. 1.100 / 3. 1.100
 libpostproc 55. 1.100 / 55. 1.100
D/LISKO: Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/emulated/0/mainVideo.mp4':
 Metadata:
 major_brand : iso6
 minor_version : 1
 compatible_brands: mp42iso6avc1isom
 creation_time : 2020-08-03T13:20:11.000000Z
 Duration: 00:00:07.04, start: 0.000000, bitrate: 1380 kb/s
 Stream #0:0(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 140 kb/s (default)
 Metadata:
 creation_time : 2020-07-28T08:11:36.000000Z
 Stream #0:1(und): Video: h264 (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720 [SAR 81:256 DAR 9:16], 1264 kb/s, 30 fps, 30 tbr, 90k tbn, 180k tbc (default)
 Metadata:
 creation_time : 2020-07-28T08:11:36.000000Z
D/LISKO: Input #1, mov,mp4,m4a,3gp,3g2,mj2, from '/storage/emulated/0/overlayVideo.mp4':
 Metadata:
 major_brand : mp42
 minor_version : 0
 compatible_brands: isommp42
 creation_time : 2020-08-04T07:27:47.000000Z
 com.android.version: 10
 Duration: 00:00:11.19, start: 0.000000, bitrate: 9993 kb/s
D/LISKO: Stream #1:0(eng): Video: h264 (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720, 9238 kb/s, SAR 1:1 DAR 16:9, 28.38 fps, 29.75 tbr, 90k tbn, 180k tbc (default)
 Metadata:
 rotate : 270
 creation_time : 2020-08-04T07:27:47.000000Z
 handler_name : VideoHandle
 Side data:
 displaymatrix: rotation of 90.00 degrees
 Stream #1:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 192 kb/s (default)
 Metadata:
 creation_time : 2020-08-04T07:27:47.000000Z
 handler_name : SoundHandle
 Stream mapping:
 Stream #0:1 (h264) -> scale2ref:ref (graph 0)
 Stream #1:0 (h264) -> scale2ref:default (graph 0)
 overlay (graph 0) -> Stream #0:0 (libx264)
 Stream #0:0 -> #0:1 (aac (native) -> aac (native))
 Press [q] to stop, [?] for help
D/LISKO: [libx264 @ 0xee986100] using SAR=81/256
D/LISKO: [libx264 @ 0xee986100] using cpu capabilities: ARMv6 NEON
 [libx264 @ 0xee986100] profile High, level 3.1
D/LISKO: [libx264 @ 0xee986100] 264 - core 152 r2851M ba24899 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12 lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
D/LISKO: Output #0, mp4, to '/storage/emulated/0/outputVideo.mp4':
D/LISKO: Metadata:
 major_brand : iso6
D/LISKO: minor_version : 1
D/LISKO: compatible_brands: mp42iso6avc1isom
D/LISKO: encoder : Lavf58.12.100
 Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 81:256 DAR 9:16], q=-1--1, 30 fps, 15360 tbn, 30 tbc (default)
D/LISKO: Metadata:
 encoder : Lavc58.18.100 libx264
 Side data:
 cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
D/LISKO: Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
 Metadata:
 creation_time : 2020-07-28T08:11:36.000000Z
D/LISKO: encoder : Lavc58.18.100 aac
D/LISKO: frame= 26 fps=0.0 q=0.0 size= 0kB time=00:00:00.09 bitrate= 4.1kbits/s dup=2 drop=0 speed=0.185x 
D/LISKO: frame= 41 fps= 41 q=0.0 size= 0kB time=00:00:00.58 bitrate= 0.7kbits/s dup=2 drop=0 speed=0.574x 
D/LISKO: frame= 49 fps= 32 q=0.0 size= 0kB time=00:00:00.92 bitrate= 0.4kbits/s dup=2 drop=0 speed=0.613x 
D/LISKO: frame= 59 fps= 29 q=29.0 size= 0kB time=00:00:01.97 bitrate= 0.2kbits/s dup=2 drop=0 speed=0.974x 
D/LISKO: frame= 75 fps= 29 q=29.0 size= 0kB time=00:00:01.97 bitrate= 0.2kbits/s dup=2 drop=0 speed=0.762x 



EDIT2 :
After adding "-shortest" to command i managed to cut overlay video to be the same length as main video (because overlay video is always longer then mainVideo, "-shortest" take short one duration. So now, command looks like this :


String[] command = {"-i", mainVideoPath, "-i", overlayVideo ,"-filter_complex", 
"[1:v][0:v]scale2ref=(256/256)*ih/8/sar:ih/8[wm][base];[base][wm]overlay=10:10", "-shortest", combinedVideoOutput};



Rotation is good so only need to merge their audios. For now, only mainVideo audio is playing, overlay video audio isn't


EDIT 3 :


String[] command = {"-i", mainVideoPath, "-i", overlayVideo ,
 "-strict", "experimental",
 "-filter_complex",
 "[1:v][0:v]scale2ref=(256/256)*ih/8/sar:ih/8[wm][base];" +
 "[base][wm]overlay=10:10; " +
 "pan=stereo|c0=2*c0|c1=3*c0[a0];[1:a]pan=stereo|c0=1*c0|c1=4*c0[a1];[a0][a1]amix=inputs=2:duration=first:dropout_transition=2",
 "-shortest" ,combinedVideoOutput};



With this command i managed to overlay videos, and play sound from both of them, rotation is good, but -shortest doesn't work now. Only existing problem now is to make them to last as shorter one (mainVideo is always shorter) ???


EDIT 4 :


This is finally working command


String[] command = {"-i", mainVideoPath, "-i", overlayVideo,
 "-filter_complex",
 "[1:v][0:v]scale2ref=(256/256)*ih/8/sar:ih/8[wm][base];" +
 "[base][wm]overlay=10:10:shortest=1;" +
 "pan=stereo|c0=2*c0|c1=3*c0[a0];[1:a]pan=stereo|c0=1*c0|c1=4*c0[a1];" +
 "[a0][a1]amix=inputs=2:duration=first:dropout_transition=2",
 combinedVideoOutput};



Thanks


-
FFMPEG input options in rust
31 juillet 2020, par Paul_ghostI want to decode rtsp stream like that :
ffplay -max_delay 50000 "rtsp://name:password@1.2.3.4:port"
. So I tried use this crate - https://crates.io/crates/ffmpeg-next , but I succeeded in only non-option receiving data with functioninput()
.
Well, I don't understand how to use that option or other options.
Should I use other crate or something else ?