Recherche avancée

Médias (91)

Autres articles (94)

  • MediaSPIP 0.1 Beta version

    25 avril 2011, par

    MediaSPIP 0.1 beta is the first version of MediaSPIP proclaimed as "usable".
    The zip file provided here only contains the sources of MediaSPIP in its standalone version.
    To get a working installation, you must manually install all-software dependencies on the server.
    If you want to use this archive for an installation in "farm mode", you will also need to proceed to other manual (...)

  • Multilang : améliorer l’interface pour les blocs multilingues

    18 février 2011, par

    Multilang est un plugin supplémentaire qui n’est pas activé par défaut lors de l’initialisation de MediaSPIP.
    Après son activation, une préconfiguration est mise en place automatiquement par MediaSPIP init permettant à la nouvelle fonctionnalité d’être automatiquement opérationnelle. Il n’est donc pas obligatoire de passer par une étape de configuration pour cela.

  • Amélioration de la version de base

    13 septembre 2013

    Jolie sélection multiple
    Le plugin Chosen permet d’améliorer l’ergonomie des champs de sélection multiple. Voir les deux images suivantes pour comparer.
    Il suffit pour cela d’activer le plugin Chosen (Configuration générale du site > Gestion des plugins), puis de configurer le plugin (Les squelettes > Chosen) en activant l’utilisation de Chosen dans le site public et en spécifiant les éléments de formulaires à améliorer, par exemple select[multiple] pour les listes à sélection multiple (...)

Sur d’autres sites (6598)

  • java.io.IOException : Error running exec() Working Directory : null Environment : null FFmpeg Android merging mp3 and mp4

    26 mai 2023, par 1234567

    java.io.IOException : Error running exec() Working Directory : null Environment : null FFmpeg Android merging mp3 and mp4

    



    I am trying following code

    



    public class Minact1 extends Activity{
    String  videoFilePath,audioFilePath,outputFilePath;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.mainact);
        videoFilePath = Environment.getExternalStorageDirectory()
                .getAbsolutePath() + "/sample2.mp4";
        audioFilePath = Environment.getExternalStorageDirectory()
                .getAbsolutePath() + "/abc.mp3";
        outputFilePath = Environment.getExternalStorageDirectory()
                .getAbsolutePath() + "/output.mp4";

        try {


            FFmpeg ffmpeg = FFmpeg.getInstance(this);
            String[] cmd =
                    {"-i " + videoFilePath + " -i " + audioFilePath +
                            " -shortest -threads 0 -preset ultrafast -strict -2 " + outputFilePath};

            ffmpeg.execute(cmd, mergeListener);
        } catch (FFmpegCommandAlreadyRunningException e) {
            e.printStackTrace();

            Toast.makeText(Minact1.this, "" +  e, Toast.LENGTH_SHORT).show();
        }
    }

    ExecuteBinaryResponseHandler mergeListener = new ExecuteBinaryResponseHandler() {
        @Override
        public void onStart() {
            //started
            Toast.makeText(Minact1.this, "started", Toast.LENGTH_SHORT).show();
        }

        @Override
        public void onFailure(String message) {
            //failed
            Toast.makeText(Minact1.this, "failed", Toast.LENGTH_SHORT).show();
        }

        @Override
        public void onFinish() {
            File output = new File(outputFilePath);
            //Do whatever with your muxed file

            Toast.makeText(Minact1.this, "onFinish", Toast.LENGTH_SHORT).show();
        }
    };
}


    



    I have used following library for FFmpeg

    



    dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:appcompat-v7:23.1.1'

    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

    compile 'com.android.support:design:23.1.1'
    compile 'com.writingminds:FFmpegAndroid:0.3.2'

    compile 'com.android.support:cardview-v7:23.1.1'
    compile 'commons-io:commons-io:2.5'
}


    



    and added following permission in manifest

    



    
    


    



    the files are present at the path used , but output.mp4 is not created

    



    the log says

    



    04-23 10:43:39.278 27191-27216/com.ffmpegtryer E/FFmpeg: Exception while trying to run: [Ljava.lang.String;@3fe418b2
04-23 10:43:39.278 27191-27216/com.ffmpegtryer E/FFmpeg: java.io.IOException: Error running exec(). Command: [/data/data/com.ffmpegtryer/files/ffmpeg, -i /storage/sdcard0/sample2.mp4 -i /storage/sdcard0/abc.mp3 -shortest -threads 0 -preset ultrafast -strict -2 /storage/sdcard0/output.mp4] Working Directory: null Environment: null
04-23 10:43:39.278 27191-27216/com.ffmpegtryer E/FFmpeg:     at java.lang.ProcessManager.exec(ProcessManager.java:211)
04-23 10:43:39.278 27191-27216/com.ffmpegtryer E/FFmpeg:     at java.lang.Runtime.exec(Runtime.java:173)
04-23 10:43:39.278 27191-27216/com.ffmpegtryer E/FFmpeg:     at java.lang.Runtime.exec(Runtime.java:128)
04-23 10:43:39.278 27191-27216/com.ffmpegtryer E/FFmpeg:     at com.github.hiteshsondhi88.libffmpeg.ShellCommand.run(ShellCommand.java:10)
04-23 10:43:39.278 27191-27216/com.ffmpegtryer E/FFmpeg:     at com.github.hiteshsondhi88.libffmpeg.FFmpegExecuteAsyncTask.doInBackground(FFmpegExecuteAsyncTask.java:38)
04-23 10:43:39.278 27191-27216/com.ffmpegtryer E/FFmpeg:     at com.github.hiteshsondhi88.libffmpeg.FFmpegExecuteAsyncTask.doInBackground(FFmpegExecuteAsyncTask.java:10)
04-23 10:43:39.278 27191-27216/com.ffmpegtryer E/FFmpeg:     at android.os.AsyncTask$2.call(AsyncTask.java:288)
04-23 10:43:39.278 27191-27216/com.ffmpegtryer E/FFmpeg:     at java.util.concurrent.FutureTask.run(FutureTask.java:237)
04-23 10:43:39.278 27191-27216/com.ffmpegtryer E/FFmpeg:     at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
04-23 10:43:39.278 27191-27216/com.ffmpegtryer E/FFmpeg:     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
04-23 10:43:39.278 27191-27216/com.ffmpegtryer E/FFmpeg:     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
04-23 10:43:39.278 27191-27216/com.ffmpegtryer E/FFmpeg:     at java.lang.Thread.run(Thread.java:818)
04-23 10:43:39.278 27191-27216/com.ffmpegtryer E/FFmpeg:  Caused by: java.io.IOException: No such file or directory
04-23 10:43:39.278 27191-27216/com.ffmpegtryer E/FFmpeg:     at java.lang.ProcessManager.exec(Native Method)
04-23 10:43:39.278 27191-27216/com.ffmpegtryer E/FFmpeg:     at java.lang.ProcessManager.exec(ProcessManager.java:209)


    



    any help would be useful

    


  • Python Youtube ffmpeg Session Has Been Invalidated

    14 août 2020, par Daniel

    I get the following error while I'm playing YouTube audio with my bot

    



    [tls @ 0000024ef8c4d480] Error in the pull function.
[matroska,webm @ 0000024ef8c4a400] Read error
[tls @ 0000024ef8c4d480] The specified session has been invalidated for some reason.
    Last message repeated 1 times


    



    It seems like YouTube links expire ? I don't really know but I need to fix this issue. This is my code :

    



        class YTDLSource(discord.PCMVolumeTransformer):

        def __init__(self, source, *, data, requester):
            super().__init__(source)
            self.requester = requester

            self.title = data['title']
            self.description = data['description']
            self.uploader = data['uploader']
            self.duration = data['duration']
            self.web_url = data['webpage_url']
            self.thumbnail = data['thumbnail']

        def __getitem__(self, item: str):
            return self.__getattribute__(item)

        @classmethod
        async def create_source(cls, ctx, player, search: str, *, loop, download=True):
            async with ctx.typing():
                loop = loop or asyncio.get_event_loop()
                to_run = partial(ytdl.extract_info, url=search, download=download)
                raw_data = await loop.run_in_executor(None, to_run)

                if 'entries' in raw_data:
                    # take first item from a playlist
                    if len(raw_data['entries']) == 1:
                        data = raw_data['entries'][0]
                    else:
                        data = raw_data['entries']
                        #loops entries to grab each video_url
                        total_duration = 0
                        try:
                            for i in data:
                                webpage = i['webpage_url']
                                title = i['title']
                                description = i['description']
                                uploader = i['uploader']
                                duration = i['duration']
                                thumbnail = i['thumbnail']
                                total_duration += duration

                                if download:
                                    source = ytdl.prepare_filename(i)
                                    source = cls(discord.FFmpegPCMAudio(source), data=i, requester=ctx.author)
                                else:
                                    source = {'webpage_url': webpage, 'requester': ctx.author, 'title': title, 'uploader': uploader, 'description': description, 'duration': duration, 'thumbnail': thumbnail}

                                player.queue.append(source)

                        except Exception as e:
                            print(e)
                            return

                        embed=discord.Embed(title="Playlist", description="Queued", color=0x30a4fb, timestamp=datetime.now(timezone.utc))
                        embed.set_author(name=ctx.author.display_name, icon_url=ctx.author.avatar_url)
                        embed.set_thumbnail(url=data[0]['thumbnail'])
                        embed.add_field(name=raw_data['title'], value=f"{len(data)} videos queued.", inline=True)
                        embed.set_footer(text=raw_data["uploader"] + ' - ' + '{0[0]}m {0[1]}s'.format(divmod(total_duration, 60)))
                        await ctx.send(embed=embed)
                        return

                embed=discord.Embed(title="Playlist", description="Queued", color=0x30a4fb, timestamp=datetime.now(timezone.utc))
                embed.set_author(name=ctx.author.display_name, icon_url=ctx.author.avatar_url)
                embed.set_thumbnail(url=data['thumbnail'])
                embed.add_field(name=data['title'], value=(data["description"][:72] + (data["description"][72:] and '...')), inline=True)
                embed.set_footer(text=data["uploader"] + ' - ' + '{0[0]}m {0[1]}s'.format(divmod(data["duration"], 60)))
                await ctx.send(embed=embed)

                if download:
                    source = ytdl.prepare_filename(data)
                else:
                    source = {'webpage_url': data['webpage_url'], 'requester': ctx.author, 'title': data['title'], 'uploader': data['uploader'], 'description': data['description'], 'duration': data['duration'], 'thumbnail': data['thumbnail']}
                    player.queue.append(source)
                    return

                source = cls(discord.FFmpegPCMAudio(source), data=data, requester=ctx.author)
                player.queue.append(source)


        @classmethod
        async def regather_stream(cls, data, *, loop):
            loop = loop or asyncio.get_event_loop()
            requester = data['requester']

            to_run = partial(ytdl.extract_info, url=data['webpage_url'], download=True)
            data = await loop.run_in_executor(None, to_run)

            return(cls(discord.FFmpegPCMAudio(data['url']), data=data, requester=requester))


    



    I'm using the rewrite branch of discord.py for the bot.
I'm not sure if I need to provide more details ? Please let me know, I really need to get this fixed...

    


  • FFmpeg record and stream

    16 janvier 2019, par Robert

    I’m getting the following error.

      E/FFmpeg: Exception while trying to run:
      [/data/user/0/com.example.pathways.testipcam/files/ffmpeg, -y, -i,
     rtsp://log:pass@IP:port/video.h264, -acodec, copy, -vcodec, copy, -t,
    00:03:00,
    content://com.example.android.fileprovider/external_files/Android/data/com.example.pathways.testipcam/files/Movies/IPcam_20190116_150628_6019720208966811003.m>kv]
    java.io.IOException: Cannot run program "/data/user/0/com.example.pathways.testipcam/files/ffmpeg": error=2, No such >file or directory

    OK I’m trying to learn how to record and stream my IP cam on android. I can stream the video in a surface view media player no problem so I then went to the record task. Now I’m a bit lost. I know this is possible as I have read people say they used this to do it.

    I started with implamenting

    implementation 'nl.bravobit:android-ffmpeg:1.1.5'

    But I can’t figure out what I am missing or doing wrong as there aren’t really any tutorials explaining this completely. So hopefully this can be the thread everyone else finds for a solution. I have listed my code below. Exactly what have I got wrong here. It runs and goes to onStart...then right on onFailure.
    DO I need to have 2 streams in order to view and watch ? or what the deal.
    I know FFmpeg can do that.
    "ffmpeg supports multiple outputs created out of the same input(s) in the same process. The usual way to accomplish this is :

    ffmpeg -i input1 -i input2 \
    -acodec … -vcodec … output1 \
    -acodec … -vcodec … output2 \"

    but I have no idea how to sue that.
    Anyway, I know I’m kind of close, at least I hope I need a little help on getting over the finish line on this. What have I done wrong, how does this work.

    Here is what I did, I streamed the video as the app does. no problem

       surfaceView = (SurfaceView) findViewById(R.id.videoView);
       _surfaceHolder = surfaceView.getHolder();
       _surfaceHolder.addCallback(this);
       _surfaceHolder.setFixedSize(320, 240);

    ....

    @Override
    public void surfaceCreated(SurfaceHolder holder) {
       mpPlayerRun();

    }

    public void mpPlayerRun(){
       _mediaPlayer = new MediaPlayer();
       _mediaPlayer.setDisplay(_surfaceHolder);

       try {
           // Specify the IP camera's URL and auth headers.
           _mediaPlayer.setDataSource(RTSP_URL);

           // Begin the process of setting up a video stream.
           _mediaPlayer.setOnPreparedListener(this);
           _mediaPlayer.prepareAsync();
       }
       catch (Exception e) {}
    }
    ...
    @Override
    public void onPrepared(MediaPlayer mp) {
       _mediaPlayer.start();
    }

    OK, so then I created a button to record.

    @Override
    public void onClick(View view) {
       switch (view.getId()) {
           case R.id.IPcamback:
               break;

           case R.id.IPcamrecord:
               if (ContextCompat.checkSelfPermission(this,
                       Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED) {
                   takeIPvid();
               } else {
                   requestIPCamPermission();
               }

    .....

    requested permission then results.

       private void requestIPCamPermission() {
       if (ActivityCompat.shouldShowRequestPermissionRationale(this,
               Manifest.permission.WRITE_EXTERNAL_STORAGE)) {

           new AlertDialog.Builder(this)
                   .setTitle("Permission needed")
                   .setMessage("This permission is needed do to android safety protocol")
                   .setPositiveButton("ok", new DialogInterface.OnClickListener() {
                       @Override
                       public void onClick(DialogInterface dialog, int which) {
                           ActivityCompat.requestPermissions(MainActivity.this,
                                   new String[] {Manifest.permission.WRITE_EXTERNAL_STORAGE}, 420);
                       }
                   })
                   .setNegativeButton("cancel", new DialogInterface.OnClickListener() {
                       @Override
                       public void onClick(DialogInterface dialog, int which) {
                           dialog.dismiss();
                       }
                   })
                   .create().show();

       } else {
           ActivityCompat.requestPermissions(this,
                   new String[] {Manifest.permission.WRITE_EXTERNAL_STORAGE}, 420);
       }
    }

    @Override
    public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {

       if (requestCode == 420)  {
           if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
               takeIPvid();
           } else {
               Toast.makeText(this, "Permission DENIED", Toast.LENGTH_SHORT).show();
           }
    .....

    then I made the file provider and createVideoOutputFile() method and the takeIPvid method.

    private File createVideoOutputFile() throws IOException {
       String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
       String imageFileName = "IPcam_" + timeStamp + "_";
       IPstorageDir = getExternalFilesDir(Environment.DIRECTORY_MOVIES);
       IPvideo_file = File.createTempFile(
               imageFileName,  /* prefix */
               ".mp4",         /* suffix */
               IPstorageDir      /* directory */
       );

       // Save a file: path for use with ACTION_VIEW intents
       String IPmVideoFilename = IPvideo_file.getAbsolutePath();
       return IPvideo_file;
    }

      private void takeIPvid() {

           File ipfile = null;
           try {
               ipfile = createVideoOutputFile();
           } catch (IOException e) {
               e.printStackTrace();
           }
       IPvideo_uri = FileProvider.getUriForFile(this,
               "com.example.android.fileprovider",
               ipfile);


       String[] cmd = {"-y", "-i", "rtsp://Login:Passord@IP:port/video.h264", "-acodec", "copy", "-vcodec", "copy","-t","00:00:20", IPvideo_uri.toString() };

       FFmpeg.getInstance(this).execute(cmd,new ExecuteBinaryResponseHandler(){

           @Override
           public void onStart() {
               super.onStart();


           }

           @Override
           public void onFailure(String message) {
               super.onFailure(message);



           }

           @Override
           public void onSuccess(String message) {
               super.onSuccess(message);


           }

           @Override
           public void onProgress(String message) {
               super.onProgress(message);

           }

           @Override
           public void onFinish() {
               super.onFinish();

           }
       });

    }