Recherche avancée

Médias (1)

Mot : - Tags -/copyleft

Autres articles (73)

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

  • XMP PHP

    13 mai 2011, par

    Dixit Wikipedia, XMP signifie :
    Extensible Metadata Platform ou XMP est un format de métadonnées basé sur XML utilisé dans les applications PDF, de photographie et de graphisme. Il a été lancé par Adobe Systems en avril 2001 en étant intégré à la version 5.0 d’Adobe Acrobat.
    Étant basé sur XML, il gère un ensemble de tags dynamiques pour l’utilisation dans le cadre du Web sémantique.
    XMP permet d’enregistrer sous forme d’un document XML des informations relatives à un fichier : titre, auteur, historique (...)

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

Sur d’autres sites (7835)

  • How to get a file converted by ffmpeg in Android : permission denied

    2 juin 2021, par Omid.N

    I am trying to use FFmpeg in my android app. So I want to test it if it works before moving on. I use an external library : github link
    
The code looks like this :

    


    package net.omidn.aslanmediaconverter;

import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

import com.arthenica.ffmpegkit.ExecuteCallback;
import com.arthenica.ffmpegkit.FFmpegKit;
import com.arthenica.ffmpegkit.FFmpegSession;
import com.arthenica.ffmpegkit.Session;

import net.bramp.ffmpeg.job.FFmpegJob;

import java.io.BufferedInputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;


public class MainActivity extends AppCompatActivity {
    
    private static final String TAG = "MainActivity";
    FFmpegJob myjob;

    @Override
    protected void onCreate(Bundle savedInstanceState) {


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

        TextView textView = (TextView) findViewById(R.id.text_view);


        FFmpegJob job = null;

        File inFile = new File("/storage/emulated/0/video_2021-05-29_17-50-20.mp4");
        String inputName = Uri.fromFile(inFile).toString();
        Log.d(TAG, inputName);
        Log.d(TAG,"file exists : " + String.valueOf(inFile.exists()));
        Log.d(TAG,"file canRead : " + String.valueOf(inFile.canRead()));

        FFmpegSession fFmpegSession = FFmpegKit.executeAsync("-i file:///storage/emulated/0/video_2021-05-29_17-50-20.mp4 -c:v mpeg4 file:///storage/emulated/0/out.mp4",
                new ExecuteCallback() {
                    @Override
                    public void apply(Session session) {

                    }
                });
        try {
            Thread.sleep(5000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        textView.setText("" + fFmpegSession.getState().name() + "    " + fFmpegSession.getOutput());
    }

}



    


    As you can see I give the files with file:/// protocol. If I don't use that the resault is the same. The three lines of Log.d(...) will print :

    


    2021-06-03 00:58:08.869 8376-8376/net.omidn.aslanmediaconverter D/MainActivity: file:///storage/emulated/0/video_2021-05-29_17-50-20.mp4
2021-06-03 00:58:08.869 8376-8376/net.omidn.aslanmediaconverter D/MainActivity: file exists : true
2021-06-03 00:58:08.869 8376-8376/net.omidn.aslanmediaconverter D/MainActivity: file canRead : false


    


    The video file has read access on the storage :
The video file has read access

    


  • How to manipulate a Uri as File in android

    3 juin 2021, par Omid.N

    I am trying to use FFmpeg in android. As you know the framework no longer lets you to use absolute paths or open files freely even with WRITE_EXTERNAL_STORAGE permission :|
    
So, using the SAF, I get the file as an Uri, then I need to put it as an argument to ffmpeg to encode it but it only accepts file paths.

    


    How can i achieve this ?

    


    Note : There are some bad practices in my code but I hope we can ignore them for now because that's not the problem here :)

    


    public class MainActivity extends AppCompatActivity {

    private static final int PICK_VIDEO_FILE = 2;

    private static final String TAG = "MainActivity";
    
    File theFile;
    TextView textView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {


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

        textView = (TextView) findViewById(R.id.text_view);

        
        if (theFile == null) {
            openFile(Uri.fromFile(new File("/storage/emulated/0/")));
        }


    }

    @Override
    protected void onResume() {
        super.onResume();
        if (theFile !=null) {

            FFmpegSession fFmpegSession = FFmpegKit.executeAsync("-i " + theFile.getAbsolutePath()
                            + " -c:v mpeg4 file:///storage/emulated/0/out.mp4",
                    new ExecuteCallback() {
                        @Override
                        public void apply(Session session) {

                        }
                    });
            try {
                Thread.sleep(5000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            textView.setText("" + fFmpegSession.getState().name() + "    " + fFmpegSession.getOutput());
        }
    }

    private void openFile(Uri pickerInitialUri) {
        Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
        intent.addCategory(Intent.CATEGORY_OPENABLE);
        intent.setType("video/mp4");
        
        // Optionally, specify a URI for the file that should appear in the
        // system file picker when it loads.
        intent.putExtra(DocumentsContract.EXTRA_INITIAL_URI, pickerInitialUri);

        startActivityForResult(intent, PICK_VIDEO_FILE);
    }
    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {

        super.onActivityResult(requestCode, resultCode, data);
        if (requestCode == PICK_VIDEO_FILE) {
            if (resultCode == RESULT_OK) {
                theFile = new File(data.getData().getPath());
            }
        }

    }



    


  • ffmpeg sequence of multiple filters syntax

    5 juillet 2021, par otomari

    i am trying to use multiple filters in ffpmeg, but it does not allow more than one -af.
so, then i decided to try to do it with a -complex_filter.

    


    sudo ffmpeg -f alsa -i default:CARD=Device \
  -filter_complex \
  "lowpass=5000,highpass=200; \
   volume=+5dB; \
   afftdn=nr=0.01:nt=w;" \
  -c:a libmp3lame -b:a 128k -ar 48000 -ac 1 -t 00:00:05 -y $recdir/audio_$(date '+%Y_%m_%d_%H_%M_%S').mp3


    


    it must work, but for some reason i get an error :

    


    Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, alsa, from 'default:CARD=Device':
  Duration: N/A, start: 1625496748.441207, bitrate: 1536 kb/s
  Stream #0:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
[AVFilterGraph @ 0xaaab0a8b14e0] No such filter: ''
Error initializing complex filters.
Invalid argument


    


    i have tried quotes and others, nothing helps..