
Recherche avancée
Médias (1)
-
Publier une image simplement
13 avril 2011, par ,
Mis à jour : Février 2012
Langue : français
Type : Video
Autres articles (88)
-
Amélioration de la version de base
13 septembre 2013Jolie sélection multiple
Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...) -
Menus personnalisés
14 novembre 2010, parMediaSPIP utilise le plugin Menus pour gérer plusieurs menus configurables pour la navigation.
Cela permet de laisser aux administrateurs de canaux la possibilité de configurer finement ces menus.
Menus créés à l’initialisation du site
Par défaut trois menus sont créés automatiquement à l’initialisation du site : Le menu principal ; Identifiant : barrenav ; Ce menu s’insère en général en haut de la page après le bloc d’entête, son identifiant le rend compatible avec les squelettes basés sur Zpip ; (...) -
Déploiements possibles
31 janvier 2010, parDeux types de déploiements sont envisageable dépendant de deux aspects : La méthode d’installation envisagée (en standalone ou en ferme) ; Le nombre d’encodages journaliers et la fréquentation envisagés ;
L’encodage de vidéos est un processus lourd consommant énormément de ressources système (CPU et RAM), il est nécessaire de prendre tout cela en considération. Ce système n’est donc possible que sur un ou plusieurs serveurs dédiés.
Version mono serveur
La version mono serveur consiste à n’utiliser qu’une (...)
Sur d’autres sites (8201)
-
FFMpeg\Exception\RuntimeException Encoding failed - Laravel 4 PHP-FFMPEG
10 avril 2014, par WoogygunI'm using PHP-FFMPEG and the latest version of FFPMEG this is the same for my localhost and production server. Im encoding a .wav file(1.5 meg 44.1khz) to .mp3 128k bit rate.
On localhost it runs without issues but, on the production server it gives the following error.
FFMpeg \ Exception \ RuntimeException
Encoding failedMy binaries are located in the public folder right now for dev purposes.
My code is as follows :
Route::get('/audio', function() {
$ffmpeg = FFMpeg\FFMpeg::create([
'ffmpeg.binaries' => 'ffmpeg',
'ffprobe.binaries' => 'ffprobe',
'timeout' => 3600]);
$audio = $ffmpeg->open(public_path('track.wav'));
$format = new FFMpeg\Format\Audio\Mp3();
$format->on('progress', function ($audio, $format, $percentage) {
echo "$percentage % transcoded";
});
$format-> setAudioKiloBitrate(128);
$audio->save($format, 'track.mp3');}) ;
I can also confirm that FFMPEG is running via shell access :
myuser@mydomain.com [~/public_html/hidden/public]# ffmpeg -i track.wav file.mp3
FFmpeg version 0.6.5, Copyright (c) 2000-2010 the FFmpeg developers
built on Jan 29 2012 23:55:02 with gcc 4.1.2 20080704 (Red Hat 4.1.2-51)
configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --
mandir=/usr/share/man --incdir=/usr/include --disable-avisynth --extra-cflags='-O2 -g -
pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-
size=4 -m64 -mtune=generic -fPIC' --enable-avfilter --enable-avfilter-lavf --enable-
libdirac --enable-libfaac --enable-libfaad --enable-libfaadbin --enable-libgsm --enable-
libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libx264 --
enable-gpl --enable-nonfree --enable-postproc --enable-pthreads --enable-shared --enable-
swscale --enable-vdpau --enable-version3 --enable-x11grab
libavutil 50.15. 1 / 50.15. 1
libavcodec 52.72. 2 / 52.72. 2
libavformat 52.64. 2 / 52.64. 2
libavdevice 52. 2. 0 / 52. 2. 0
libavfilter 1.19. 0 / 1.19. 0
libswscale 0.11. 0 / 0.11. 0
libpostproc 51. 2. 0 / 51. 2. 0
[wav @ 0x8434b0]max_analyze_duration reached
[wav @ 0x8434b0]Estimating duration from bitrate, this may be inaccurate
Input #0, wav, from 'track.wav':
Duration: 00:00:08.98, bitrate: 1411 kb/s
Stream #0.0: Audio: pcm_s16le, 44100 Hz, 2 channels, s16, 1411 kb/s
Output #0, mp3, to 'file.mp3':
Metadata:
TSSE : Lavf52.64.2
Stream #0.0: Audio: libmp3lame, 44100 Hz, 2 channels, s16, 64 kb/s
Stream mapping:
Stream #0.0 -> #0.0
Press [q] to stop encoding
size= 70kB time=9.01 bitrate= 64.0kbits/s
video:0kB audio:70kB global headers:0kB muxing overhead 0.045772% -
NoMethodFoundException when trying to load native methods from jar file
20 février 2018, par Anuran BarmanI am trying to load ffmpeg methods in android. My requirement is that I dont want to pack the .so files within the apk.Only if the user wants then only I will download the jar file and load the ffmpeg native methods.After searching I think that loading .so files at run time is not possible.So what I did that I made the so file and created a different android application with only one class FFMPEG.java whose only duty is to call the native methods from ffmpeg library.so I made the jar file and loaded that into my main application with ClassLoader. Constructor is getting called so it means class is loaded but methods are not getting loaded though they are declared public in the jar file. I am trying to stream RTSP video with FFMPEG.Below are my jar file and main application codes.
public class FFMPEG {
public FFMPEG(){
Log.d(FFMPEG.class.getSimpleName(),"constructor called");
}
public static native int naInit(String pFileName);
public static native int[] naGetVideoRes();
public static native void naSetSurface(Surface pSurface);
public static native int naSetup(int pWidth, int pHeight);
public static native void naPlay();
public static native void naStop();
public static boolean loadedLibraries;
static {
try {
System.loadLibrary("avutil");
System.loadLibrary("avcodec");
System.loadLibrary("avformat");
System.loadLibrary("swscale");
System.loadLibrary("avfilter");
System.loadLibrary("ffmpeg-jni");
loadedLibraries = true;
} catch (Throwable e) {
e.printStackTrace();
}
}
public int libInit(String filename){
return naInit(filename);
}
public int[] libGetVideoRes(){
return naGetVideoRes();
}
public void libSetSurface(Surface surface){
naSetSurface(surface);
}
public int libSetup(int width,int height){
return naSetup(width,height);
}
public void libPlay(){
naPlay();
}
public void libStop(){
naStop();
}
}My main application activity code.The jar file location in my sdcard named camlib.jar
@SuppressWarnings("JniMissingFunction")
public class MainActivity extends AppCompatActivity implements SurfaceHolder.Callback {
private SurfaceView surfaceView;
private ProgressBar progressBar;
private final String TAG=MainActivity.class.getSimpleName();
private boolean isPlaying;
private boolean isClassLoaded;
private boolean isInitialized;
private String url="";
Method libInit,libGetVideoRes,libSetSurface,libSetup,libPlay,libStop;
Object myInstance;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_main);
surfaceView = (SurfaceView) findViewById(R.id.surfaceView);
progressBar = ((ProgressBar) findViewById(R.id.progressBar));
surfaceView.getHolder().addCallback(this);
int permission= ActivityCompat.checkSelfPermission(this, Manifest.permission.READ_EXTERNAL_STORAGE);
if(permission== PackageManager.PERMISSION_GRANTED){
loadClass();
}else{
ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},200);
}
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if(requestCode==200){
if(grantResults.length>0){
if (grantResults[0]==PackageManager.PERMISSION_GRANTED){
loadClass();
}else{
ActivityCompat.requestPermissions(this,new String[]{Manifest.permission.READ_EXTERNAL_STORAGE},200);
}
}
}
}
public void loadClass(){
try {
final String libPath = Environment.getExternalStorageDirectory() + "/camlib.jar";
final File tmpDir = getDir("dex", 0);
final DexClassLoader classloader = new DexClassLoader(libPath, tmpDir.getAbsolutePath(), null, this.getClass().getClassLoader());
final Class classToLoad = (Class) classloader.loadClass("com.myeglu.obbapplication.FFMPEG");
myInstance = classToLoad.newInstance();
libInit= classToLoad.getMethod("libInit");
libGetVideoRes=classToLoad.getMethod("libGetVideoRes");
libSetSurface=classToLoad.getMethod("libSetSurface");
libSetup=classToLoad.getMethod("libSetup");
libPlay=classToLoad.getMethod("libPlay");
libStop=classToLoad.getMethod("libStop");
isClassLoaded=true;
new PlayVideo().execute();
} catch (Exception e) {
e.printStackTrace();
}
}
private void postInit() {
if (isInitialized) {
initPlay();
progressBar.setVisibility(View.GONE);
} else {
finish();
}
}
private void initPlay() {
try {
int[] res = (int[])libGetVideoRes.invoke(myInstance);
Log.d("ANURAN", "res width " + res[0] + ": height " + res[1]);
if (res[0] <= 0) {
res[0] = 480;
}
if (res[1] <= 0) {
res[1] = 320;
}
int[] screenRes = getScreenRes();
int width, height;
float widthScaledRatio = screenRes[0] * 1.0f / res[0];
float heightScaledRatio = screenRes[1] * 1.0f / res[1];
if (widthScaledRatio > heightScaledRatio) {
//use heightScaledRatio
width = (int) (res[0] * heightScaledRatio);
height = screenRes[1];
} else {
//use widthScaledRatio
width = screenRes[0];
height = (int) (res[1] * widthScaledRatio);
}
Log.d(TAG, "width " + width + ",height:" + height);
updateSurfaceView(width, height);
libSetup.invoke(myInstance,width,height);
playMedia();
}catch (Exception e){
}
}
private void playMedia() {
try {
if (progressBar.getVisibility() == View.VISIBLE) {
progressBar.setVisibility(View.GONE);
}
libPlay.invoke(myInstance);
isPlaying = true;
}catch (Exception e){
}
}
private void updateSurfaceView(int pWidth, int pHeight) {
//update surfaceview dimension, this will cause the native window to change
Log.d("ANURAN UPDATE SURFACE", "width " + pWidth + ",height:" + pHeight);
FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) surfaceView.getLayoutParams();
params.width = pWidth;
params.height = pHeight;
surfaceView.setLayoutParams(params);
}
@SuppressLint("NewApi")
private int[] getScreenRes() {
int[] res = new int[2];
Display display = getWindowManager().getDefaultDisplay();
Point size = new Point();
display.getSize(size);
res[0] = size.x;
res[1] = size.y;
return res;
}
@Override
protected void onStop() {
super.onStop();
Toast.makeText(MainActivity.this,"onStop called",Toast.LENGTH_SHORT).show();
stopPlaying();
finish();
}
@Override
public void onBackPressed() {
stopPlaying();
finish();
}
private void stopPlaying() {
isPlaying = false;
try{
libStop.invoke(myInstance);
}catch (Exception e){
}
}
@Override
protected void onDestroy() {
super.onDestroy();
stopPlaying();
finish();
}
@Override
protected void onRestart() {
super.onRestart();
Toast.makeText(MainActivity.this,"onRestart called",Toast.LENGTH_SHORT).show();
progressBar.setVisibility(View.VISIBLE);
}
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width,
int height) {
if(isClassLoaded){
try {
libSetSurface.invoke(myInstance,holder.getSurface());
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
}
@Override
public void surfaceCreated(SurfaceHolder holder) {
}
@Override
public void surfaceDestroyed(SurfaceHolder holder) {
if(isClassLoaded) {
try {
libSetSurface.invoke(myInstance, null);
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
}
private class PlayVideo extends AsyncTask {
@Override
protected Void doInBackground(Void... voids) {
try {
int temp=(int)libInit.invoke(myInstance,url);
isInitialized=(temp==0);
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
return null;
}
@Override
protected void onPostExecute(Void aVoid) {
super.onPostExecute(aVoid);
postInit();
this.cancel(true);
}
}
} -
Building FFmpeg with NVIDIA GPU Hardware Acceleration in docker image, cannot load libnvcuvid.so.1 and libnvidia-encode.so.1
22 mars 2023, par konovificationI'm trying to build FFmpeg with NVIDIA GPU Hardware Acceleration following these instructions : https://docs.nvidia.com/video-technologies/video-codec-sdk/ffmpeg-with-nvidia-gpu/index.html#compiling-for-linux. The Docker image I'm using is
nvidia/cuda:12.0.1-devel-ubuntu20.04


Running the test command
ffmpeg -y -vsync 0 -hwaccel cuda -hwaccel_output_format cuda -i bbb.mp4 -c:a copy -c:v h264_nvenc -b:v 5M output.mp4
, I get the following output :

ffmpeg version N-109965-ge50a02b0f6 Copyright (c) 2000-2023 the FFmpeg developers 
 built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1) 
 configuration: --enable-nonfree --enable-cuda-nvcc --enable-libnpp --extra-cflags=-I/usr/local/cuda/include --extra-ldflags=-L/usr/local/cuda/lib64 --disable-static --enable-shared 
 libavutil 58. 3.100 / 58. 3.100 
 libavcodec 60. 6.100 / 60. 6.100 
 libavformat 60. 4.100 / 60. 4.100 
 libavdevice 60. 2.100 / 60. 2.100 
 libavfilter 9. 4.100 / 9. 4.100 
 libswscale 7. 2.100 / 7. 2.100 
 libswresample 4. 11.100 / 4. 11.100 
-vsync is deprecated. Use -fps_mode 
Passing a number to -vsync is deprecated, use a string argument as described in the manual. 
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'bbb.mp4': 
 Metadata: 
 major_brand : isom 
 minor_version : 1 
 compatible_brands: isomavc1 
 creation_time : 2013-12-16T17:44:39.000000Z 
 title : Big Buck Bunny, Sunflower version 
 artist : Blender Foundation 2008, Janus Bager Kristensen 2013 
 comment : Creative Commons Attribution 3.0 - http://bbb3d.renderfarming.net 
 genre : Animation 
 composer : Sacha Goedegebure 
 Duration: 00:10:34.60, start: 0.000000, bitrate: 3481 kb/s 
 Stream #0:0[0x1](und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 2998 kb/s, 30 fps, 30 tbr, 30k tbn (default)
 Metadata: 
 creation_time : 2013-12-16T17:44:39.000000Z 
 handler_name : GPAC ISO Video Handler 
 vendor_id : [0][0][0][0] 
 Stream #0:1[0x2](und): Audio: mp3 (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 160 kb/s (default) 
 Metadata: 
 creation_time : 2013-12-16T17:44:42.000000Z 
 handler_name : GPAC ISO Audio Handler 
 vendor_id : [0][0][0][0] 
 Stream #0:2[0x3](und): Audio: ac3 (ac-3 / 0x332D6361), 48000 Hz, 5.1(side), fltp, 320 kb/s (default) 
 Metadata: 
 creation_time : 2013-12-16T17:44:42.000000Z 
 handler_name : GPAC ISO Audio Handler 
 vendor_id : [0][0][0][0] 
 Side data: 
 audio service type: main 
Stream mapping: 
 Stream #0:0 -> #0:0 (h264 (native) -> h264 (h264_nvenc)) 
 Stream #0:2 -> #0:1 (copy) 
Press [q] to stop, [?] for help 
[h264 @ 0x55bd878c2d80] Cannot load libnvcuvid.so.1 
[h264 @ 0x55bd878c2d80] Failed loading nvcuvid. 
[h264 @ 0x55bd878c2d80] Failed setup for format cuda: hwaccel initialisation returned error. 
[h264_nvenc @ 0x55bd86f5e680] Cannot load libnvidia-encode.so.1 
[h264_nvenc @ 0x55bd86f5e680] The minimum required Nvidia driver for nvenc is 520.56.06 or newer 
[vost#0:0/h264_nvenc @ 0x55bd86f5e1c0] Error initializing output stream: Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
Conversion failed! 



Output from
nvidia-smi
:

+-----------------------------------------------------------------------------+
| NVIDIA-SMI 525.85.05 Driver Version: 525.85.05 CUDA Version: 12.0 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+======================|
| 0 NVIDIA GeForce ... Off | 00000000:01:00.0 On | N/A |
| 27% 43C P8 12W / 250W | 500MiB / 11264MiB | 1% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
 
+-----------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=============================================================================|
+-----------------------------------------------------------------------------+



The shared libraries are not part of the docker image. What are my options to add them ?