Recherche avancée

Médias (91)

Autres articles (70)

  • 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 (...)

  • Les tâches Cron régulières de la ferme

    1er décembre 2010, par

    La gestion de la ferme passe par l’exécution à intervalle régulier de plusieurs tâches répétitives dites Cron.
    Le super Cron (gestion_mutu_super_cron)
    Cette tâche, planifiée chaque minute, a pour simple effet d’appeler le Cron de l’ensemble des instances de la mutualisation régulièrement. Couplée avec un Cron système sur le site central de la mutualisation, cela permet de simplement générer des visites régulières sur les différents sites et éviter que les tâches des sites peu visités soient trop (...)

  • Les formats acceptés

    28 janvier 2010, par

    Les commandes suivantes permettent d’avoir des informations sur les formats et codecs gérés par l’installation local de ffmpeg :
    ffmpeg -codecs ffmpeg -formats
    Les format videos acceptés en entrée
    Cette liste est non exhaustive, elle met en exergue les principaux formats utilisés : h264 : H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 m4v : raw MPEG-4 video format flv : Flash Video (FLV) / Sorenson Spark / Sorenson H.263 Theora wmv :
    Les formats vidéos de sortie possibles
    Dans un premier temps on (...)

Sur d’autres sites (7313)

  • Checking Video Quality using WP Code, Forminator and FFmpeg is not working [closed]

    3 septembre 2024, par guiliannkamga Guilian90

    I have a WordPress website where users should be able to upload videos. The quality of the videos should be checked upon upload, meaning the videos must have a 16:9 aspect ratio and be in HD. If a video does not meet these conditions, the upload should not be allowed, and the user should be informed of the reason.

    


    I am using the WordPress plugin Forminator for the video upload form and WP Code with a code snippet that contains PHP code. FFmpeg version 4.4.2 is installed on my server.

    


    ffmpeg version

    


    Form to upload a Video

    


    My provider is DreamHost, and I can connect to the server via Terminal on my MacBook and run ffmpeg commands without any issues.

    


    I added the form to a page and when I upload invalid videos, unfortunately, I do not receive any error messages, which should be happening according to my code, and I do not know why.

    


    Uploading the Video

    


    Success Message after uploading the Video

    


    Can someone help me ?

    


    add_filter('forminator_custom_form_submit_before_set_fields', 'forminator_video_validation', 10, 3);

function forminator_video_validation($entry, $form_id, $field_data) {
    foreach ($field_data as $field) {
        if ($field['name'] === 'upload-1') { // 'upload-1' is the ID of the Datei-Upload-Field in Forminator
            $file = $field['value']['file']['file_path'];

            // check if the file exists
            if (!file_exists($file)) {
                wp_die('File does not exist');
            }

            // ffmpeg command to check video size and resolution
            $command = "ffmpeg -i " . escapeshellarg($file) . " 2>&1";
            $output = shell_exec($command);

            // extract resoltion from the ffmpeg output
            if (preg_match('/Stream #0:0.*Video:.* (\d+)x(\d+)/', $output, $matches)) {
                $width = (int) $matches[1];
                $height = (int) $matches[2];
                $aspect_ratio = $width / $height;
                $allowed_aspect_ratio = 16 / 9;
                $min_width = 1280;
                $min_height = 720;

                // check if the video fullfills the criterias
                if ($width < $min_width || $height < $min_height || round($aspect_ratio, 2) != round($allowed_aspect_ratio, 2)) {
                    wp_die('The video must be at least in HD (1280x720) and must have the format 16:9. (Found: ' . $width . 'x' . $height . ')');
                }
            } else {
                // If the video could not be analysed
                wp_die('The Video could not be analysed');
            }
        }
    }
}


    


    PHP Code Snippet in WPCode

    


    WPCode Settings

    


  • how to call a c function in the C++ function with the same name ?

    25 juillet 2013, par wolfz

    how to call a c function in the C++ function with the same name ?
    calling 'extern "c"' to use c header and ": :"operation to use the c function,
    but the link error occur.

    my code :

    extern "C" {
    #include <libavcodec></libavcodec>avcodec.h>
    }
    ...
    class DllAvCodec
    {
     public:
     ...
     virtual void av_free_packet(AVPacket *pkt) { ::av_free_packet(pkt); }
     ...
    }

    the error :

    D:/player/jni/lib/DllAvCodec.h:143: error: undefined reference to &#39;av_free_packet(AVPacket*)&#39;

    why the code "::av_free_packet(pkt)" invoke undefined ?

    my Android.mk is :

    LOCAL_PATH := $(call my-dir)
    DEFINES += \
              -DTARGET_POSIX \
              -DTARGET_LINUX \
              -D_LINUX \
              -DTARGET_ANDROID \
              -D__STDC_CONSTANT_MACROS

    ######################################
    #build ffmpeg prebuilt lib
    ######################################
    include $(CLEAR_VARS)  
    LOCAL_MODULE := libavcodec
    LOCAL_SRC_FILES := lib/lib/libavcodec.a
    LOCAL_EXPORT_C_INCLUDES +=$(LOCAL_PATH)/lib/include
    include $(PREBUILT_STATIC_LIBRARY)

    include $(CLEAR_VARS)  
    LOCAL_MODULE := libavfilter  
    LOCAL_SRC_FILES := lib/lib/libavfilter.a
    LOCAL_EXPORT_C_INCLUDES +=$(LOCAL_PATH)/lib/include
    include $(PREBUILT_STATIC_LIBRARY)

    include $(CLEAR_VARS)  
    LOCAL_MODULE := libavformat  
    LOCAL_SRC_FILES := lib/lib/libavformat.a  
    LOCAL_EXPORT_C_INCLUDES +=$(LOCAL_PATH)/lib/include
    include $(PREBUILT_STATIC_LIBRARY)

    include $(CLEAR_VARS)  
    LOCAL_MODULE := libavutil  
    LOCAL_SRC_FILES := lib/lib/libavutil.a  
    LOCAL_EXPORT_C_INCLUDES +=$(LOCAL_PATH)/lib/include
    include $(PREBUILT_STATIC_LIBRARY)

    include $(CLEAR_VARS)  
    LOCAL_MODULE := libpostproc  
    LOCAL_SRC_FILES := lib/lib/libpostproc.a  
    LOCAL_EXPORT_C_INCLUDES +=$(LOCAL_PATH)/lib/include
    include $(PREBUILT_STATIC_LIBRARY)

    include $(CLEAR_VARS)  
    LOCAL_MODULE := libswresample  
    LOCAL_SRC_FILES := lib/lib/libswresample.a  
    LOCAL_EXPORT_C_INCLUDES +=$(LOCAL_PATH)/lib/include
    include $(PREBUILT_STATIC_LIBRARY)

    include $(CLEAR_VARS)  
    LOCAL_MODULE := libswscale  
    LOCAL_SRC_FILES := lib/lib/libswscale.a
    LOCAL_EXPORT_C_INCLUDES +=$(LOCAL_PATH)/lib/include
    include $(PREBUILT_STATIC_LIBRARY)


    ######################################
    #build lib
    ######################################
    include $(CLEAR_VARS)
    LOCAL_MODULE:= player
    base := $(LOCAL_PATH)

    LOCAL_SRC_FILES += ......

    LOCAL_CPPFLAGS += -Wall -fexceptions $(DEFINES)  
    LOCAL_LDLIBS += -llog -lz
    LOCAL_LDFLAGS += -L../jni/lib/lib  -lavcodec -lavformat  -lavutil -lavfilter -lpostproc  -lswscale -lswresample

    LOCAL_STATIC_LIBRARIES := libavcodec \
                             libavformat \
                             libavutil \
                             libavfilter \
                             libpostproc \
                             libswscale \
                             libswresample

    include $(BUILD_SHARED_LIBRARY)
  • Using an array of strings as a function parameter in a function that builds another array

    22 octobre 2019, par NCrusher

    I start with an empty array :

    var ffmpegFilters = [String]()

    I have a button that should start an ffmpeg process when I click it :

    @IBAction func startConversionClicked(_ sender: Any) {
       //buildFfmpegString()
       ffmpegConvert(inputPath: inputFilePath, filters: ffmpegFilters, outputPath: "outputFilePath")
    }

    The function with the process looks like this :

    func ffmpegConvert(inputPath: String, filters: String, outputPath: String) {
       guard let launchPath = Bundle.main.path(forResource: "ffmpeg", ofType: "") else { return }
       do {
           let convertTask: Process = Process()
           convertTask.launchPath = launchPath
           convertTask.arguments = [
               "-i", inputPath,
               filters,
               outputPath
           ]
           convertTask.standardInput = FileHandle.nullDevice
           convertTask.launch()
           convertTask.waitUntilExit()
       }
    }

    the ffmpegFilters variable array is defined in another function :

    func conversionSelection() {
       if inputFileUrl != nil {
           let conversionChoice = conversionOptionsPopup.indexOfSelectedItem
           switch conversionChoice {
               case 1 :
                   outputExtension = ".mp3"
                   ffmpegFilters = ["-c:a libmp3lame", "-ac 1", "-ar 22050", "-q:a 9"]
               case 2 :
                   outputExtension = ".mp3"
                   ffmpegFilters = ["-c:a libmp3lame", "-ac 2", "-ar 44100", "-q:a 5"]
               case 3 :
                   outputExtension = ".mp3"
                   ffmpegFilters = ["-c:a libmp3lame", "-ac 1", "-ar 22050", "-b:a 32k"]
               case 4:
                   outputExtension = ".flac"
                   ffmpegFilters = ["-c:a flac"]
               default :
                   outputExtension = ".m4b"
                   ffmpegFilters = ["-c copy"]
           }
       }
    }

    So my array of strings is being used as an item in another array of strings.
    When I do this, my @IBAction at the top there gives me an error :

    Cannot convert value of type ’[String]’ to expected argument type
    ’String’

    And I’m not sure how to fix that. It’s really important I get the formatting of these ffmpeg arguments correct, because right now my project is stuck due to ffmpeg not liking the arguments Swift is passing to it in this process, so I’m trying to make everything relating to the arguments as bullet-proof as I can.