
Recherche avancée
Médias (1)
-
Video d’abeille en portrait
14 mai 2011, par
Mis à jour : Février 2012
Langue : français
Type : Video
Autres articles (60)
-
List of compatible distributions
26 avril 2011, parThe table below is the list of Linux distributions compatible with the automated installation script of MediaSPIP. Distribution nameVersion nameVersion number Debian Squeeze 6.x.x Debian Weezy 7.x.x Debian Jessie 8.x.x Ubuntu The Precise Pangolin 12.04 LTS Ubuntu The Trusty Tahr 14.04
If you want to help us improve this list, you can provide us access to a machine whose distribution is not mentioned above or send the necessary fixes to add (...) -
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 (...) -
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 ;
Sur d’autres sites (10585)
-
How to fix the problem I'm having with FFmpeg ?
23 février 2023, par JohnI'm working with the ffmpeg library to convert mp4 video files to mp3 audio files.
Here is my code :


package com.exer;


import android.app.Activity;
import android.app.ProgressDialog;
import android.os.Bundle;
import android.os.Environment;
import android.widget.Toast;
import com.github.hiteshsondhi88.libffmpeg.ExecuteBinaryResponseHandler;
import com.github.hiteshsondhi88.libffmpeg.FFmpeg;
import com.github.hiteshsondhi88.libffmpeg.FFmpegLoadBinaryResponseHandler;

public class MainActivity extends Activity {
 
 FFmpeg ffmpeg;
 private ProgressDialog progressDialog;
 
 
 @Override
 protected void onCreate(Bundle savedInstanceState) {
 super.onCreate(savedInstanceState);
 setContentView(R.layout.activity_main);
 
 
 
 try {
 setUp();
 String[] command = {
 "-i", getPaths()+"/dir/input.mp4", "-vn", getPaths()+"/dir/output.mp3"
 };
 //convert("ffmpeg -i input.mp4 -vn output.mp3");
 convert(command);
 
 } catch (Exception e) {
 Toast.makeText(getApplicationContext(), e.getCause().toString(), Toast.LENGTH_SHORT).show();
 }
 }
 
 
 public void setUp() throws Exception {
 
 if(ffmpeg == null) {
 
 ffmpeg = FFmpeg.getInstance(this);
 ffmpeg.loadBinary(new FFmpegLoadBinaryResponseHandler(){
 
 @Override
 public void onFailure() {
 Toast.makeText(getApplicationContext(), "failed to load library", Toast.LENGTH_SHORT).show(); 
 }
 
 @Override
 public void onSuccess() {
 Toast.makeText(getApplicationContext(), "loaded!", Toast.LENGTH_SHORT).show();
 }
 
 @Override
 public void onStart() {
 
 }
 
 @Override
 public void onFinish() {
 
 }
 
 
 });
 
 }
 
 }
 
 
 private void convert(String[] cmd) throws Exception {
 
 ffmpeg.execute(cmd, new ExecuteBinaryResponseHandler(){
 
 @Override
 public void onFailure(String message){
 super.onFailure(message);
 }
 
 @Override
 public void onFinish(){
 super.onFinish();
 Toast.makeText(getApplicationContext(), "finished!", Toast.LENGTH_SHORT).show();
 }
 
 @Override
 public void onStart(){
 super.onStart();
 Toast.makeText(getApplicationContext(), "start conversion...", Toast.LENGTH_SHORT).show();
 }
 
 @Override
 public void onProgress(String message){
 super.onProgress(message);
 }
 });
 
 
 }
 
 private String getPaths() {
 return Environment.getExternalStorageDirectory().getPath();
 }
 
}



When I run the app, the Toast messages are shown :


loaded!

start converting...

finished!
as I write them in the functions, apart that nothing else happens the file is not converted what's wrong ?

Here my manifest file :


<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.exer">
 
 
 
 
 
 
 
 <action></action>

 <category></category>
 
 
 

</manifest>



I've tried to delete the specified file on the phone to see what erros I might got, but still those three Toasts.


-
Can't install FFMPEG using pip
22 juin 2023, par turrnutI tried to install ffmpeg using pip like this


pip install ffmpeg



However I got the following error :


Collecting ffmpeg
 Using cached ffmpeg-1.4.tar.gz (5.1 kB)
 Preparing metadata (setup.py) ... error
 error: subprocess-exited-with-error

 × python setup.py egg_info did not run successfully.
 │ exit code: 1
 ╰─> [34 lines of output]
 Traceback (most recent call last):
 File "<string>", line 2, in <module>
 File "", line 34, in <module>
 File "C:\Users\vwu20\AppData\Local\Temp\pip-install-rdqrdeeq\ffmpeg_3cdda176f3f04ceea4a14d868e94924e\setup.py", line 13, in <module>
 setup(
 File "C:\Users\vwu20\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\__init__.py", line 87, in setup
 return distutils.core.setup(**attrs)
 File "C:\Users\vwu20\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\_distutils\core.py", line 147, in setup
 _setup_distribution = dist = klass(attrs)
 File "C:\Users\vwu20\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\dist.py", line 476, in __init__
 _Distribution.__init__(
 File "C:\Users\vwu20\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\_distutils\dist.py", line 282, in __init__
 self.finalize_options()
 File "C:\Users\vwu20\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\dist.py", line 899, in finalize_options
 for ep in sorted(loaded, key=by_order):
 File "C:\Users\vwu20\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\dist.py", line 898, in <lambda>
 loaded = map(lambda e: e.load(), filtered)
 File "C:\Users\vwu20\AppData\Local\Programs\Python\Python310\lib\importlib\metadata\__init__.py", line 171, in load
 module = import_module(match.group('module'))
 File "C:\Users\vwu20\AppData\Local\Programs\Python\Python310\lib\importlib\__init__.py", line 126, in import_module
 return _bootstrap._gcd_import(name[level:], package, level)
 File "<frozen>", line 1050, in _gcd_import
 File "<frozen>", line 1027, in _find_and_load
 File "<frozen>", line 1006, in _find_and_load_unlocked
 File "<frozen>", line 688, in _load_unlocked
 File "<frozen>", line 883, in exec_module
 File "<frozen>", line 241, in _call_with_frames_removed
 File "C:\Users\vwu20\AppData\Local\Programs\Python\Python310\lib\site-packages\py2app\build_app.py", line 37, in <module>
 from py2app.create_appbundle import create_appbundle
 File "C:\Users\vwu20\AppData\Local\Programs\Python\Python310\lib\site-packages\py2app\create_appbundle.py", line 9, in <module>
 from py2app.util import make_exec, makedirs, mergecopy, mergetree, skipscm
 File "C:\Users\vwu20\AppData\Local\Programs\Python\Python310\lib\site-packages\py2app\util.py", line 5, in <module>
 import fcntl
 ModuleNotFoundError: No module named 'fcntl'
 [end of output]

 note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
</module></module></module></frozen></frozen></frozen></frozen></frozen></frozen></lambda></module></module></module></string>


The error message says that it's missing a package called
fcntl
, so i tried to install it using

pip install fcntl



The attempt to install fcntl produce the following error :


ERROR: Could not find a version that satisfies the requirement fcntl (from versions: none)
ERROR: No matching distribution found for fcntl



Can anyone tell me what I did wrong ? I am using windows 11, python 3.10, pip 23.1.2
Help would be appreciated.


-
Encoding video using FFmpeg and FreeImage
14 mai 2014, par mikeI have to make a video encoder to encode video using mjpeg codec from many jpgs saved on the disk. I use FreeImage to load images and ffmpeg to encode. Unfortunately, the output video isn’t that what I expect. I can’t play it in MPC. VLC can play it but there is only a single quick flash of the last picture I loaded. I want to have 1 fps video and for example I loaded 4 frames so my video should last 4 seconds.
Input pictures are in BGR24 pixel format.
What is more, when I run my code I got swscaler warning that picture format YUVJ420P is deprecated but I cant find another pixel format which is suitable for MJPEG codec.
Here is my source code :
AVPixelFormat in_pix_fmt = AV_PIX_FMT_BGR24;
AVPixelFormat out_pix_fmt = AV_PIX_FMT_YUVJ420P;
AVCodec *pCodec;
AVCodecContext *pCodecCtx = NULL;
int out_size = 0;
int size, outbuf_size, i, outpic_size, w, h;
FILE *file;
const char *videofile_name = "test_video_cpp.avi";
AVFrame *picture, *outpic;
uint8_t *outbuf, *picture_buf, *outpic_buf;
av_register_all();
pCodec = avcodec_find_encoder(CODEC_ID_MJPEG);
if (!pCodec)
{
cout << "Codec not found\n\n";
return 1;
}
pCodecCtx = avcodec_alloc_context3(pCodec);
picture = avcodec_alloc_frame();
outpic = avcodec_alloc_frame();
pCodecCtx->codec_id = CODEC_ID_MJPEG;
pCodecCtx->codec_type = AVMEDIA_TYPE_VIDEO;
pCodecCtx->pix_fmt = out_pix_fmt;
pCodecCtx->bit_rate = 400000;
pCodecCtx->width = 1688;
pCodecCtx->height = 728;
pCodecCtx->time_base.num = 1;
pCodecCtx->time_base.den = 1; //fps
pCodecCtx->max_b_frames = 0;
outbuf_size = 500000;
outbuf = new uint8_t[outbuf_size];
if (avcodec_open2(pCodecCtx, pCodec, NULL) < 0) //open codec
{
cout << "Could not open codec\n";
exit(1);
}
file = fopen(videofile_name, "wb"); //open file
if (!file)
{
cout << "Could not open " << videofile_name << endl;
exit(1);
}
outpic_size = avpicture_get_size(out_pix_fmt, pCodecCtx->width, pCodecCtx->height);
outpic_buf = new uint8_t[outpic_size];
cout << "Outpic size was setted to: " << outpic_size << endl;
size = pCodecCtx->width * pCodecCtx->height;
picture_buf = new uint8_t[size * 3];
for (i = 1; i < 5; i++)
{
fflush(stdout);
stringstream ss;
ss << i;
filename = name + ss.str() + ext;
path = dir + filename;
dib = FreeImage_Load(FIF_JPEG, path.c_str(), 0);
picture_buf = FreeImage_GetBits(dib);
h = FreeImage_GetHeight(dib);
w = FreeImage_GetWidth(dib);
avpicture_fill((AVPicture*)picture, picture_buf, in_pix_fmt, w, h);
avpicture_fill((AVPicture*)outpic, outpic_buf, out_pix_fmt, pCodecCtx->width, pCodecCtx->height);
struct SwsContext* fooContext = sws_getContext(w, h, in_pix_fmt, pCodecCtx->width, pCodecCtx->height, out_pix_fmt, SWS_BICUBIC, NULL, NULL, NULL);
sws_scale(fooContext, picture->data, picture->linesize, 0, pCodecCtx->height, outpic->data, outpic->linesize);
//encode single frame
out_size = avcodec_encode_video(pCodecCtx, outpic_buf, outpic_size, outpic);
cout << "encoding frame " << i << "(size=" << out_size << ")\n";
fwrite(outbuf, 1, out_size, file);
}
//encode delayed frames
for ( ; out_size; i++)
{
fflush(stdout);
out_size = avcodec_encode_video(pCodecCtx, outbuf, outbuf_size, NULL);
cout << "write frame " << i << "(size=" << out_size << ")\n";
fwrite(outbuf, 1, out_size, file);
}
outbuf[0] = 0x00;
outbuf[1] = 0x00;
outbuf[2] = 0x01;
outbuf[3] = 0xb7;
fwrite(outbuf, 1, 4, file);
fclose(file);
delete outbuf;
avcodec_close(pCodecCtx);
av_free(pCodecCtx);
avpicture_free((AVPicture*)picture);
avpicture_free((AVPicture*)outpic);
delete picture_buf;
delete outpic_buf;