Recherche avancée

Médias (91)

Autres articles (103)

  • Mise à disposition des fichiers

    14 avril 2011, par

    Par défaut, lors de son initialisation, MediaSPIP ne permet pas aux visiteurs de télécharger les fichiers qu’ils soient originaux ou le résultat de leur transformation ou encodage. Il permet uniquement de les visualiser.
    Cependant, il est possible et facile d’autoriser les visiteurs à avoir accès à ces documents et ce sous différentes formes.
    Tout cela se passe dans la page de configuration du squelette. Il vous faut aller dans l’espace d’administration du canal, et choisir dans la navigation (...)

  • Problèmes fréquents

    10 mars 2010, par

    PHP et safe_mode activé
    Une des principales sources de problèmes relève de la configuration de PHP et notamment de l’activation du safe_mode
    La solution consiterait à soit désactiver le safe_mode soit placer le script dans un répertoire accessible par apache pour le site

  • Gestion générale des documents

    13 mai 2011, par

    MédiaSPIP ne modifie jamais le document original mis en ligne.
    Pour chaque document mis en ligne il effectue deux opérations successives : la création d’une version supplémentaire qui peut être facilement consultée en ligne tout en laissant l’original téléchargeable dans le cas où le document original ne peut être lu dans un navigateur Internet ; la récupération des métadonnées du document original pour illustrer textuellement le fichier ;
    Les tableaux ci-dessous expliquent ce que peut faire MédiaSPIP (...)

Sur d’autres sites (7709)

  • Python can't access FFmpeg binary in /data/user/0/com.app.name/files/ in Android Studio

    18 octobre 2024, par Dudek 3D

    I'm a beginner in android development (and java). I'm making a hybrid application in java which runs python (using chaquopy).
MainActivity.java runs the python script fine, the only problem is that the yt_dlp library that I've used can't access FFmpeg.
The FFmpeg binary file (for linuxarm64, I don't think that's the problem) is located in the assets folder (src/main/assets), then it's copied to /data/user/0/com.app.name/files :

    


    //FileUtils.java
public class FileUtils {
    public static void copyAsset(Context context, String assetName, String outputPath) {
        AssetManager assetManager = context.getAssets();
        try {
            InputStream in = assetManager.open(assetName);
            File outFile = new File(outputPath);
            OutputStream out = new FileOutputStream(outFile);
            byte[] buffer = new byte[1024];
            int read;
            while ((read = in.read(buffer)) != -1) {
                out.write(buffer, 0, read);
            }
            in.close();
            out.close();

            // Set executable permissions for the binary
            outFile.setExecutable(true);  // Ensure the file is executable
            outFile.setReadable(true);
            outFile.setWritable(true);
            Log.d("FileUtils", "FFmpeg File - Exists: " + outFile.exists() +
                    ", Executable: " + outFile.canExecute());

        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}


//MainActivity.java
public class MainActivity extends AppCompatActivity {
    private pyRun pyrun;
    private static final int REQUEST_CODE_PERMISSION = 123;
    private static final String TAG = "MainActivity";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        Log.d("YTDownloader", "onCreate: Starting...");
        String ffmpegPath = getFilesDir() + "/ffmpeg";

        // Copy the binary
        FileUtils.copyAsset(this, "ffmpeg", ffmpegPath);

        // Check if file exist and log
        Log.d(TAG, "FFmpeg exists: " + new File(ffmpegPath).exists());
        Log.d(TAG, "PATH: "+ffmpegPath);

        //load python
        //load webview
    }
    //other functions
}


    


    And finally it should be loaded by yt_dlp in python :

    


    import os
import yt_dlp as youtube_dl
ffmpeg_path='/data/user/0/com.dudek3d.ytdownloader/files/ffmpeg'

ydl_opts = {
'ffmpeg_location': ffmpeg_path,
'format': 'bestvideo+bestaudio/best',
'postprocessors': [{
        'key': 'FFmpegVideoConvertor',
        'preferedformat': 'mp4'}],
'noplaylist': True,
'quiet': True,
'merge_output_format': 'mp4',
'outtmpl': filename+'.%(ext)s',
}

with youtube_dl.YoutubeDL(ydl_opts) as ydl:
    ydl.download([url])


    


    The downloaded file is corrupted because FFmpeg is not found.
I've found out that ffmpeg file cannot be accessed from neither Java nor Python.

    


    I've tried :

    


    1)
Changing the paths to cache : ffmpeg_path='/data/user/0/com.dudek3d.ytdownloader/cache/ffmpeg'
Changing the paths to data : ffmpeg_path='/data/data/com.dudek3d.ytdownloader/files/ffmpeg'
Changing the paths to data cache : ffmpeg_path='/data/data/com.dudek3d.ytdownloader/cache/ffmpeg'

    


    2)
Accessing ffmpeg path from MainActivity.java and got "Permission Denied" Error, so I added

    


    



    


    to AndroidManifest.xml but still the same error occurs.

    


    3)
Using ffmpeg implementations in dependecies in build.gradle (app Module) such as : 'com.arthenica:ffmpeg-kit-full:4.5'
but this won't work because I think that's accessible by java and not python.

    


    4)
I've changed location of ffmpeg to src/main/jniLibs/arc64-v8a :
ffmpegPath = getApplicationInfo().nativeLibraryDir + "/ffmpeg";
passed that to python :

    


    def run(format_choice, listt, ffmpeg_pat, ffprobe_pat):
    global ffmpeg_path, ffprobe_path
    ffmpeg_path, ffprobe_path= ffmpeg_pat, ffprobe_pat


    


    but I got :
WARNING: ffmpeg-location /data/app/~~42sSKOephY26jjdLYW7wmw==/com.dudek3d.ytdownloader-OWqWbazkZobYNlsqTsxfyA==/lib/x86_64/ffmpeg does not exist!

    


    I hope it's clear, thanks in advance.

    


  • using ffmpeg.jar with android (in android studio)

    7 mai 2016, par Dany Y

    I’m trying to use FFmpegFrameRecorder in android. I tried all the possible configurations and still having java.lang.UnsatisfiedLinkError: org.bytedeco.javacpp.avutil on runtime.

    I already added the files :

     - ffmpeg.jar
     - ffmpeg-android-arm.jar
     - javacpp.jar
     - javacv.jar
     - opencv-android-arm.jar
     - opencv.jar

    I tried from the javacv-presets and javacvbin

    I tried to extract opencv.jar and ffmpeg.jar and copy the .so files in the jnlibs and in jnlibs/armvebi

    Any idea what should be done ?

  • avconv : make -map_metadata work consistently with the other options

    29 juillet 2011, par Anton Khirnov

    avconv : make -map_metadata work consistently with the other options