Recherche avancée

Médias (21)

Mot : - Tags -/Nine Inch Nails

Autres articles (73)

  • Personnaliser en ajoutant son logo, sa bannière ou son image de fond

    5 septembre 2013, par

    Certains thèmes prennent en compte trois éléments de personnalisation : l’ajout d’un logo ; l’ajout d’une bannière l’ajout d’une image de fond ;

  • Le profil des utilisateurs

    12 avril 2011, par

    Chaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
    L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...)

  • Configurer la prise en compte des langues

    15 novembre 2010, par

    Accéder à la configuration et ajouter des langues prises en compte
    Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
    De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
    Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...)

Sur d’autres sites (5679)

  • FFmpeg4Android : How to select videos from gallery ?

    4 décembre 2015, par marian

    I have created an app using FFmpeg4Android library. I would like to add watermark into videos using ffmpeg. Command for adding watermark is working fine but the coding has pre-fixed video name in the command. I would like to choose videos from gallery folder and then add watermark to the videos. I do not know how to add intent for choosing videos with FFmpeg. I have tried to add the intent like this replacing the in.mp4 with PICK_FROM_GALLERY intent :

    private void runTranscodingUsingLoader() {
       Log.i(Prefs.TAG, "runTranscodingUsingLoader started...");

       PowerManager powerManager = (PowerManager)ProgressBarExample.this.getSystemService(Activity.POWER_SERVICE);
       WakeLock wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "VK_LOCK");
       Log.d(Prefs.TAG, "Acquire wake lock");
       wakeLock.acquire();

       Intent intent = new Intent();

       intent.setType("video/*");
       intent.setAction(Intent.ACTION_GET_CONTENT);

       startActivityForResult(Intent.createChooser(intent, "Complete action using"), PICK_FROM_GALLERY);


       String[] complexCommand = {"ffmpeg","-y" ,"-i", String.valueOf(PICK_FROM_GALLERY),"-strict","experimental",
               "-vf", "movie=/sdcard/videokit/watermark.png [watermark];" +
               " [in][watermark] overlay=main_w-overlay_w-10:10 [out]","-s",
               "320x240","-r", "30", "-b", "15496k", "-vcodec", "mpeg4","-ab",
               "48000", "-ac", "2", "-ar", "22050", "/sdcard/videokit/out1.mp4"};

    It opens the gallery but the watermarking command doesnt get executed in the selected video. Can someone help me to resolve this issue. I could not find proper references/examples regarding this. My full coding is as follows.

    public class ProgressBarExample extends Activity  {

    public ProgressDialog progressBar;

    String workFolder = null;
    String demoVideoFolder = null;
    String demoVideoPath = null;
    String vkLogPath = null;
    LoadJNI vk;
    private final int STOP_TRANSCODING_MSG = -1;
    private final int FINISHED_TRANSCODING_MSG = 0;
    private boolean commandValidationFailedFlag = false;
    private static final int PICK_FROM_GALLERY = 1;

    private void runTranscodingUsingLoader() {
       Log.i(Prefs.TAG, "runTranscodingUsingLoader started...");

       PowerManager powerManager = (PowerManager)ProgressBarExample.this.getSystemService(Activity.POWER_SERVICE);
       WakeLock wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "VK_LOCK");
       Log.d(Prefs.TAG, "Acquire wake lock");
       wakeLock.acquire();




       String[] complexCommand = {"ffmpeg","-y" ,"-i", "/sdcard/videokit/in.mp4","-strict","experimental",
               "-vf", "movie=/sdcard/videokit/watermark.png [watermark];" +
               " [in][watermark] overlay=main_w-overlay_w-10:10 [out]","-s",
               "320x240","-r", "30", "-b", "15496k", "-vcodec", "mpeg4","-ab",
               "48000", "-ac", "2", "-ar", "22050", "/sdcard/videokit/out1.mp4"};
       ///////////////////////////////////////////////////////////////////////


       vk = new LoadJNI();
       try {
           // running complex command with validation
           vk.run(complexCommand, workFolder, getApplicationContext());

           // running without command validation
           //vk.run(complexCommand, workFolder, getApplicationContext(), false);

           // running regular command with validation
           //vk.run(GeneralUtils.utilConvertToComplex(commandStr), workFolder, getApplicationContext());

           Log.i(Prefs.TAG, "vk.run finished.");
           // copying vk.log (internal native log) to the videokit folder
           GeneralUtils.copyFileToFolder(vkLogPath, demoVideoFolder);

       } catch (CommandValidationException e) {
           Log.e(Prefs.TAG, "vk run exeption.", e);
           commandValidationFailedFlag = true;

       } catch (Throwable e) {
           Log.e(Prefs.TAG, "vk run exeption.", e);
       }
       finally {
           if (wakeLock.isHeld()) {
               wakeLock.release();
               Log.i(Prefs.TAG, "Wake lock released");
           }
           else{
               Log.i(Prefs.TAG, "Wake lock is already released, doing nothing");
           }
       }

       // finished Toast
       String rc = null;
       if (commandValidationFailedFlag) {
           rc = "Command Vaidation Failed";
       }
       else {
           rc = GeneralUtils.getReturnCodeFromLog(vkLogPath);
       }
       final String status = rc;
       ProgressBarExample.this.runOnUiThread(new Runnable() {
           public void run() {
               Toast.makeText(ProgressBarExample.this, status, Toast.LENGTH_LONG).show();
               if (status.equals("Transcoding Status: Failed")) {
                   Toast.makeText(ProgressBarExample.this, "Check: " + vkLogPath + " for more information.", Toast.LENGTH_LONG).show();
               }
           }
       });
    }


    @Override
    public void onCreate(Bundle savedInstanceState) {
       Log.i(Prefs.TAG, "onCreate ffmpeg4android ProgressBarExample");

       super.onCreate(savedInstanceState);
       setContentView(R.layout.ffmpeg_demo_client_2);

       demoVideoFolder = Environment.getExternalStorageDirectory().getAbsolutePath() + "/videokit/";
       demoVideoPath = demoVideoFolder + "in.mp4";

       Log.i(Prefs.TAG, getString(R.string.app_name) + " version: " + GeneralUtils.getVersionName(getApplicationContext()) );

       Button invoke =  (Button)findViewById(R.id.invokeButton);
       invoke.setOnClickListener(new OnClickListener() {
           public void onClick(View v){
               Log.i(Prefs.TAG, "run clicked.");
               runTranscoding();
           }
       });

       workFolder = getApplicationContext().getFilesDir() + "/";
       Log.i(Prefs.TAG, "workFolder (license and logs location) path: " + workFolder);
       vkLogPath = workFolder + "vk.log";
       Log.i(Prefs.TAG, "vk log (native log) path: " + vkLogPath);
       GeneralUtils.copyLicenseFromAssetsToSDIfNeeded(this, workFolder);
       GeneralUtils.copyDemoVideoFromAssetsToSDIfNeeded(this, demoVideoFolder);
       int rc = GeneralUtils.isLicenseValid(getApplicationContext(), workFolder);
       Log.i(Prefs.TAG, "License check RC: " + rc);
    }



    private Handler handler = new Handler() {
       @Override
       public void handleMessage(Message msg) {
           Log.i(Prefs.TAG, "Handler got message");
           if (progressBar != null) {
               progressBar.dismiss();

               // stopping the transcoding native
               if (msg.what == STOP_TRANSCODING_MSG) {
                   Log.i(Prefs.TAG, "Got cancel message, calling fexit");
                   vk.fExit(getApplicationContext());


               }
           }
       }
    };

    public void runTranscoding() {
       progressBar = new ProgressDialog(ProgressBarExample.this);
       progressBar.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
       progressBar.setTitle("FFmpeg4Android Direct JNI");
       progressBar.setMessage("Press the cancel button to end the operation");
       progressBar.setMax(100);
       progressBar.setProgress(0);

       progressBar.setCancelable(false);
       progressBar.setButton(DialogInterface.BUTTON_NEGATIVE, "Cancel", new DialogInterface.OnClickListener() {
           @Override
           public void onClick(DialogInterface dialog, int which) {
               handler.sendEmptyMessage(STOP_TRANSCODING_MSG);
           }
       });

       progressBar.show();

       new Thread() {
           public void run() {
               Log.d(Prefs.TAG,"Worker started");
               try {
                   //sleep(5000);
                   runTranscodingUsingLoader();
                   handler.sendEmptyMessage(FINISHED_TRANSCODING_MSG);

               } catch(Exception e) {
                   Log.e("threadmessage",e.getMessage());
               }
           }
       }.start();

       // Progress update thread
       new Thread() {
           ProgressCalculator pc = new ProgressCalculator(vkLogPath);
           public void run() {
               Log.d(Prefs.TAG,"Progress update started");
               int progress = -1;
               try {
                   while (true) {
                       sleep(300);
                       progress = pc.calcProgress();
                       if (progress != 0 && progress < 100) {
                           progressBar.setProgress(progress);
                       }
                       else if (progress == 100) {
                           Log.i(Prefs.TAG, "==== progress is 100, exiting Progress update thread");
                           pc.initCalcParamsForNextInter();
                           break;
                       }
                   }

               } catch(Exception e) {
                   Log.e("threadmessage",e.getMessage());
               }
           }
       }.start();
    }

    }

    Any help/guidance would be really helpful. Thank you.

  • Moving ffmpeg from root to user/local

    25 janvier 2015, par Edward Meaderds

    I noticed that when I followed a guide to install ffmpeg (some time ago), that all of the scripts i want to use, say that ffmpeg need to be in the /usr/local/bin/ffmpeg mine is in root, how do I move the folder to the correct location without messing anything up ? My server is centos 6.5

  • Compiling qt project with use of ffmpeg on x64 system

    5 juin 2013, par Srv19

    I have a qt project that uses some ffmpeg functionality, that i have compiled previously on windows (x86) and ubuntu. However, its x86 binaries do not work correctly on x64 windows machine. I have tried compiling it but have run into a strange problem.

    All ffmpeg functions i use are listed as unresolved exgternals ; and the most pecicular thing is, their names all ahve a leading underscore attached to them (so, avformat_close_input -> _avformat_close_input etc). To be sure, i have downloaded latest ffmpeg libraries for x64 machines and run them through a dependency walker - no leading underscores anywhere.

    How to fix this problem ?

    Here is my .pro file :

    #-------------------------------------------------
    #
    # Project created by QtCreator 2013-05-17T10:55:01
    #
    #-------------------------------------------------


    QT       += core gui

    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

    TARGET = LPR_Demo
    TEMPLATE = app
    # The application version
    VERSION = 1.0

    # Define the preprocessor macro to get the application version in our application.
    DEFINES += APP_VERSION=\\\"$$VERSION\\\"
    SOURCES += main.cpp\
           mainwindow.cpp \
       imgProcessor.cpp \
       qpicturelabel.cpp \
       aboutdialog.cpp \
       state.cpp \
       qt_videoreader.cpp \
       roidialog.cpp \
       recognitionresult.cpp \
       ffmpeg_reader.cpp \
       label_videoplayer.cpp

    HEADERS  += mainwindow.h \
       imgProcessor.h \
       qpicturelabel.h \
       aboutdialog.h \
       state.h \
       qt_videoreader.h \
       roidialog.h \
       recognitionresult.h \
       global.h \
       ffmpeg_reader.h \
       label_videoplayer.h

    FORMS    += mainwindow.ui \
       aboutdialog.ui \
       roidialog.ui
    LPRDIR = $$PWD/LPR
    win32: LIBS += -L$$LPRDIR/bin/ -lliblpr
    unix:LIBS += -L$$LPRDIR/bin -lLPR

    INCLUDEPATH += $$LPRDIR/include

    DEPENDPATH += $$LPRDIR/include

    INCLUDEPATH += $$PWD/
    DEPENDPATH += $$PWD/

    #OTHER_FILES += \
    #    ffmpeg.pri
    include(ffmpeg.pri)
    #LIBS += -lavformat -lavcodec -lavutil -lswscale

    RESOURCES += \
       lpr_Res.qrc

    win32 {
    dlls_to_move.path += $$OUT_PWD/bin

    dlls_to_move.files += $$LPRDIR/bin/liblpr.dll

    QTDIR=C:/Qt/4.8.4/

    CONFIG (debug, debug|release) {

    dlls_to_move.files += $$QTDIR/bin/QtCored4.dll \
       $$QTDIR/bin/QtGuid4.dll

    }
    CONFIG (release, debug|release) {

    dlls_to_move.files += $$QTDIR/bin/QtCore4.dll \
       $$QTDIR/bin/QtGui4.dll
    }
    img_format.path += $$OUT_PWD/bin/imageformats
    CONFIG (debug, debug|release) {

    img_format.files += $$QTDIR/plugins/imageformats/qgifd4.dll \
       $$QTDIR/plugins/imageformats/qicod4.dll \
       $$QTDIR/plugins/imageformats/qjpegd4.dll \
       $$QTDIR/plugins/imageformats/qmngd4.dll \
       $$QTDIR/plugins/imageformats/qsvgd4.dll \
       $$QTDIR/plugins/imageformats/qtgad4.dll \
       $$QTDIR/plugins/imageformats/qtiffd4.dll

    }
    CONFIG (release, debug|release) {

    img_format.files += $$QTDIR/plugins/imageformats/qgif4.dll \
       $$QTDIR/plugins/imageformats/qico4.dll \
       $$QTDIR/plugins/imageformats/qjpeg4.dll \
       $$QTDIR/plugins/imageformats/qmng4.dll \
       $$QTDIR/plugins/imageformats/qsvg4.dll \
       $$QTDIR/plugins/imageformats/qtga4.dll \
       $$QTDIR/plugins/imageformats/qtiff4.dll
    }

    ffmpeg_dll.path += $$OUT_PWD/bin

    ffmpeg_dll.files += $$FFMPEG_LIBRARY_PATH/avutil-*.dll \
       $$FFMPEG_LIBRARY_PATH/avcodec-*.dll \
       $$FFMPEG_LIBRARY_PATH/avformat-*.dll \
       $$FFMPEG_LIBRARY_PATH/swscale-*.dll

    main_exe.path += $$OUT_PWD/bin
    CONFIG (debug, debug|release) {

    main_exe.files += $$OUT_PWD/debug/LPR_Demo.exe

    }
    CONFIG (release, debug|release) {
    main_exe.files += $$OUT_PWD/release/LPR_Demo.exe

    }
    INSTALLS += dlls_to_move img_format ffmpeg_dll main_exe
    }

    unix {
    CONFIG (release, debug|release) {
       QMAKE_PRE_LINK += rm LPR_Demo_cmpr LPR_Demo$$escape_expand(\n\t)
       QMAKE_POST_LINK += upx -9 -oLPR_Demo_cmpr LPR_Demo$$escape_expand(\n\t)
       QMAKE_POST_LINK += cp -v -u LPR_Demo_cmpr $$OUT_PWD/../artifacts/examples/qt_demo/bin/unix
    }
    }

    and here is pri file for ffmpeg :

    # Include the configuration file below in the QT .pro file, and modify the path accordingly.


    # ##############################################################################
    # ##############################################################################
    # FFMPEG: START OF CONFIGURATION BELOW ->
    # Copy these lines into your own project
    # Make sure to set the path variables for:
    # 1) ffmpeg_reader,
    # 2) FFMPEG include path (i.e. where the directories libavcodec, libavutil, etc. lie),
    # 3) the binary FFMPEG libraries (that must be compiled separately).
    # Under Linux path 2 and 3 may not need to be set as these are usually in the standard include and lib path.
    # Under Windows, path 2 and 3 must be set to the location where you placed the FFMPEG includes and compiled binaries
    # Note that the FFMPEG dynamic librairies (i.e. the .dll files) must be in the PATH
    # ##############################################################################
    # ##############################################################################

    # ##############################################################################
    # Modify here: set FFMPEG_LIBRARY_PATH and FFMPEG_INCLUDE_PATH
    # ##############################################################################

    # Set FFMPEG_LIBRARY_PATH to point to the directory containing the FFmpeg import libraries (if needed - typically for Windows), i.e. the dll.a files
    win32:FFMPEG_LIBRARY_PATH = $$PWD/ffmpeg/lib

    unix: FFMPEG_LIBRARY_PATH = /usr/local/lib

    # Set FFMPEG_INCLUDE_PATH to point to the directory containing the FFMPEG includes (if needed - typically for Windows)
    win32:FFMPEG_INCLUDE_PATH = $$PWD/ffmpeg/include
    unix:FFMPEG_INCLUDE_PATH = /usr/local/include
    # ##############################################################################
    # Do not modify: FFMPEG default settings
    # ##############################################################################


    # Set list of required FFmpeg libraries
    #unix:LIBS += -L$$FFMPEG_LIBRARY_PATH
    unix:LIBS += -lavformat -lavcodec -lavutil -lswscale
    # Add the path
    win32:LIBS += -L$$FFMPEG_LIBRARY_PATH
    win32:LIBS += -lavformat -lavcodec -lavutil -lswscale
    INCLUDEPATH += $$FFMPEG_INCLUDE_PATH

    # Requied for some C99 defines
    DEFINES += __STDC_CONSTANT_MACROS

    # ##############################################################################
    # FFMPEG: END OF CONFIGURATION
    # ##############################################################################