Recherche avancée

Médias (3)

Mot : - Tags -/plugin

Autres articles (99)

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

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

  • Des sites réalisés avec MediaSPIP

    2 mai 2011, par

    Cette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
    Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page.

Sur d’autres sites (10805)

  • Video Encoding issue

    6 octobre 2014, par pbellema

    I’m making an app that records small videos and concatenates them together (like Vine).
    If I record a video without concatenation there are no problems.
    But if I assemble recordings, two problems appear : records disappear or they are cut out.

    When I start to record :

    private boolean prepareVideoRecorder(){
       if (mCamera != null) {
           mMediaRecorder = new MediaRecorder();

           Camera.Parameters p = mCamera.getParameters();

           CamcorderProfile profile = CamcorderProfile.get(CamcorderProfile.QUALITY_480P);

           // Step 1: Unlock and set camera to MediaRecorder
           mCamera.unlock();
           mMediaRecorder.setCamera(mCamera);

          //mMediaRecorder.setOrientationHint(90);

           Log.i("MY_LOG", "set preview display");


           mMediaRecorder.setMaxDuration(8000);

           // Step 2: Set sources
           mMediaRecorder.setAudioSource(MediaRecorder.AudioSource.CAMCORDER);
           mMediaRecorder.setVideoSource(MediaRecorder.VideoSource.CAMERA);

           // Step 3: Set a CamcorderProfile (requires API Level 8 or higher)
           mMediaRecorder.setProfile(profile);




           mMediaRecorder.setVideoSize(profile.videoFrameWidth,profile.videoFrameHeight);

           // Step 4: Set output file
           mMediaRecorder.setOutputFile(getOutputMediaFile().toString());

           if (mFrontCamera) {

               mMediaRecorder.setPreviewDisplay(mFrontPreview.getHolder().getSurface());
           } else {
               mMediaRecorder.setPreviewDisplay(mBackPreview.getHolder().getSurface());
           }

           // Step 6: Prepare configured MediaRecorder
           try {
               mMediaRecorder.prepare();
           } catch (IllegalStateException e) {
               Log.d("MY_LOG", "IllegalStateException preparing MediaRecorder: " + e.getMessage());
               releaseMediaRecorder();
               return false;
           } catch (IOException e) {
               Log.d("MY_LOG", "IOException preparing MediaRecorder: " + e.getMessage());
               releaseMediaRecorder();
               return false;
           }
           return true;
       } else {
           Log.i("MY_LOG", "camera null");
           return false;
       }

    And when I stop :

    private void stopRecording(boolean forcedStop) {
       mRecording = false;
       try {
           mMediaRecorder.stop();
           releaseMediaRecorder();
           mCamera.lock();
           rotateVideo(mPaths.size() - 1, mFrontCamera);
          if (forcedStop) manageVideos(forcedStop);
       } catch (RuntimeException e) {
           Log.i("MY_LOG", "Exception" + e.toString());
       }
    }

    and when I finish, those are my concatenation functions :

    private void manageVideos(boolean forcedStop) {
       if (mPaths.size() > 1 || forcedStop) {
           String mediaStorageDirPath = Helper.getMediaStorageDirPath();
           String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
           final String path = mediaStorageDirPath + File.separator +
                   "APPEND_"+ timeStamp + ".mp4";

           finalVideo = path;
           ffmpegAppend(path);
       } else {
           finalVideo = mPaths.get(0);
           if (!isProcessingFFmpeg) {
               goToSubtitleFragment(finalVideo);
           }
       }
    }

    private void ffmpegAppend(String path) {
       String mediaStorageDirPath = Helper.getMediaStorageDirPath();
       String filePath = mediaStorageDirPath + File.separator + "append.txt";

       try {
           File f = new File(filePath);

           OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream(f));
           BufferedWriter writer = new BufferedWriter(out);

           for (int i = 0; i < mPaths.size(); i++) {
               writer.write("file '" + mPaths.get(i) + "'");
               writer.newLine();
           }

           writer.close();

           String cmd = "ffmpeg -f concat -i " + filePath + " -c copy " + path;

           mCmd.add(cmd);

           manageCommands();

       } catch (Exception e) {

       }
    }

    private void manageCommands() {
       if (!isProcessingFFmpeg && mCmd.size() > 0) {
           new FFmpegTask().execute(mCmd.get(0));
       }
    }

    private class FFmpegTask extends AsyncTask {
       protected Integer doInBackground(String... cmd) {
           isProcessingFFmpeg = true;
           int fileCount = cmd.length;

           Processor p = new Processor(Helper.getEncodingLibraryPath(getActivity()), getActivity());

           for (String c : cmd) {
               String[] strArr = c.split(" ");
               p.process(strArr);
           }

           return fileCount;
       }

       protected void onProgressUpdate(Integer... progress) {

       }

       protected void onPostExecute(Integer result) {
           StackTraceElement[] ste = Thread.currentThread().getStackTrace();
           isProcessingFFmpeg = false;
           if (mCmd.size() > 0) {
               mCmd.remove(0);
           }
           if (mCmd.size() > 0) {
               new FFmpegTask().execute(mCmd.get(0));
           } else if (isFinished) {
               goToSubtitleFragment(finalVideo);
           }
       }
    }

    Do you see where the problems might be coming from ?
    Thanks to you.

  • React Native (Android) : Download mp3 file

    21 février 2024, par Batuhan Fındık

    I get the youtube video link from the ui. I download the video from this link and convert it to mp3. I download it to my phone as mp3. The song opens on WhatsApp on the phone. but it doesn't open on the mp3 player. The song is not broken because it opens on WhatsApp too. Why do you think the mp3 player doesn't open ? Could it be from the file information ? I tried to enter some file information but it still won't open. For example, there is from information in songs played on an mp3 player. There is no from information in my song file. I tried to add it but it wasn't added.

    


    .net 8 api return :

    


        [HttpPost("ConvertVideoToMp3")]&#xA;public async Task<iactionresult> ConvertVideoToMp3(Mp3 data)&#xA;{&#xA;    try&#xA;    {&#xA;        string videoId = GetYoutubeVideoId(data.VideoUrl);&#xA;&#xA;        var streamInfoSet = await _youtubeClient.Videos.Streams.GetManifestAsync(videoId);&#xA;        var videoStreamInfo = streamInfoSet.GetAudioOnlyStreams().GetWithHighestBitrate();&#xA;&#xA;        if (videoStreamInfo != null)&#xA;        {&#xA;            var videoStream = await _youtubeClient.Videos.Streams.GetAsync(videoStreamInfo);&#xA;            var memoryStream = new MemoryStream();&#xA;&#xA;            await videoStream.CopyToAsync(memoryStream);&#xA;            memoryStream.Seek(0, SeekOrigin.Begin);&#xA;&#xA;            var videoFilePath = $"{videoId}.mp4";&#xA;            await System.IO.File.WriteAllBytesAsync(videoFilePath, memoryStream.ToArray());&#xA;&#xA;            var mp3FilePath = $"{videoId}.mp3";&#xA;            var ffmpegProcess = Process.Start(new ProcessStartInfo&#xA;            {&#xA;                FileName = "ffmpeg",&#xA;                Arguments = $"-i \"{videoFilePath}\" -vn -acodec libmp3lame -ab 128k -id3v2_version 3 -metadata artist=\"YourArtistName\" -metadata title=\"YourTitle\" -metadata from=\"youtube\" \"{mp3FilePath}\"",&#xA;                RedirectStandardError = true,&#xA;                UseShellExecute = false,&#xA;                CreateNoWindow = true&#xA;            });&#xA;&#xA;            await ffmpegProcess.WaitForExitAsync();&#xA;&#xA;            var file = TagLib.File.Create(mp3FilePath);&#xA;&#xA;   &#xA;            file.Tag.Artists = new string [] { "YourArtistName"};&#xA;            file.Tag.Title = "YourTitle";&#xA;            file.Tag.Album = "YourAlbumName"; &#xA;            file.Tag.Comment = "Source: youtube";&#xA;  &#xA;&#xA;            file.Save();&#xA;&#xA;            var mp3Bytes = await System.IO.File.ReadAllBytesAsync(mp3FilePath);&#xA;&#xA;            System.IO.File.Delete(videoFilePath);&#xA;            System.IO.File.Delete(mp3FilePath);&#xA;&#xA;            return File(mp3Bytes, "audio/mpeg", $"{videoId}.mp3");&#xA;        }&#xA;        else&#xA;        {&#xA;            return NotFound("Video stream not found");&#xA;        }&#xA;    }&#xA;    catch (Exception ex)&#xA;    {&#xA;        return StatusCode(500, $"An error occurred: {ex.Message}");&#xA;    }&#xA;}&#xA;</iactionresult>

    &#xA;

    React Native :

    &#xA;

         const handleConvertAndDownload = async () => {&#xA;    try {&#xA;      const url = &#x27;http://192.168.1.5:8080/api/Mp3/ConvertVideoToMp3&#x27;;&#xA;      const fileName = &#x27;example&#x27;;&#xA;      const newFileName = generateUniqueSongName(fileName);&#xA;      const filePath = RNFS.DownloadDirectoryPath &#x2B; &#x27;/&#x27;&#x2B;newFileName;&#xA;&#xA;      fetch(url, {&#xA;        method: &#x27;POST&#x27;,&#xA;        headers: {&#xA;          &#x27;Content-Type&#x27;: &#x27;application/json&#x27;,&#xA;        },&#xA;        body: JSON.stringify({videoUrl:videoUrl}),&#xA;      })&#xA;      .then((response) => {&#xA;        if (!response.ok) {&#xA;          Alert.alert(&#x27;Error&#x27;, &#x27;Network&#x27;);&#xA;          throw new Error(&#x27;Network response was not ok&#x27;);&#xA;        }&#xA;        return response.blob();&#xA;      })&#xA;      .then((blob) => {&#xA;        return new Promise((resolve, reject) => {&#xA;          const reader = new FileReader();&#xA;          reader.onloadend = () => {&#xA;            resolve(reader.result.split(&#x27;,&#x27;)[1]); &#xA;          };&#xA;          reader.onerror = reject;&#xA;          reader.readAsDataURL(blob);&#xA;        });&#xA;      })&#xA;      .then((base64Data) => {&#xA;        // Dosyanın varlığını kontrol et&#xA;        return RNFS.exists(filePath)&#xA;          .then((exists) => {&#xA;            if (exists) {&#xA;              console.log(&#x27;File already exists&#x27;);&#xA;              return RNFS.writeFile(filePath, base64Data, &#x27;base64&#x27;, &#x27;append&#x27;);&#xA;            } else {&#xA;              console.log(&#x27;File does not exist&#x27;);&#xA;              return RNFS.writeFile(filePath, base64Data, &#x27;base64&#x27;);&#xA;            }&#xA;          })&#xA;          .catch((error) => {&#xA;            console.error(&#x27;Error checking file existence:&#x27;, error);&#xA;            throw error;&#xA;          });&#xA;      })&#xA;      .then(() => {&#xA;        Alert.alert(&#x27;Success&#x27;, &#x27;MP3 file downloaded successfully.&#x27;);&#xA;        console.log(&#x27;File downloaded successfully!&#x27;);&#xA;      })&#xA;      .catch((error) => {&#xA;        Alert.alert(&#x27;Error&#x27;, error.message);&#xA;        console.error(&#x27;Error downloading file:&#x27;, error);&#xA;      });&#xA;    } catch (error) {&#xA;      Alert.alert(&#x27;Error&#x27;, error.message);&#xA;      console.error(error);&#xA;    }&#xA;  };&#xA;

    &#xA;

  • ServletOutputStream failed to flush :

    18 septembre 2024, par Dawid

    I try to convert m3u8 file to WebM using ffmpeg and stream it onto browser.&#xA;I want it to play on browser without using any javascript.&#xA;Stream video method :

    &#xA;

     public void streamVideo(OutputStream os ){&#xA;&#xA;       String url = "m3u8file.m3u8";&#xA;&#xA;&#xA;        byte[] bytes = new byte[BUFFER];&#xA;        int bytesRead = -1;&#xA;&#xA;        ProcessBuilder pb = new ProcessBuilder(&#xA;                "ffmpeg",&#xA;                "-i", url,&#xA;                "-c:v", "libvpx-vp9",  &#xA;                "-b:v", "1M",           &#xA;                "-c:a", "libopus",      &#xA;                "-b:a", "128k",&#xA;                "-f", "webm",           &#xA;                "pipe:1"                &#xA;        );&#xA;        pb.redirectErrorStream(true);&#xA;&#xA;        try {&#xA;                    Process process = pb.start();&#xA;            try (&#xA;                    InputStream is = process.getInputStream()){&#xA;&#xA;                while((bytesRead = is.read(bytes)) != -1){&#xA;                    os.write(bytes, 0 , bytesRead);&#xA;                    os.flush();&#xA;                }&#xA;&#xA;&#xA;            }catch (IOException ex){&#xA;                ex.printStackTrace();&#xA;            }&#xA;&#xA;&#xA;        }catch (IOException ex){&#xA;            ex.printStackTrace();&#xA;        }&#xA;&#xA;&#xA;&#xA;    }&#xA;&#xA;&#xA;}&#xA;

    &#xA;

    Web Controller

    &#xA;

     &#xA; @Autowired&#xA;    private VideoService videoService;&#xA;&#xA;    @GetMapping("/stream")&#xA;    public ResponseEntity<streamingresponsebody> streamVideo(@RequestHeader(value = "Range", required = false) String rangeHeader) {&#xA;        HttpHeaders headers = new HttpHeaders();&#xA;&#xA;        headers.add("Content-Type", "video/webm");&#xA;        headers.add("Accept-Ranges", "bytes");&#xA;&#xA;        StreamingResponseBody responseStream  = os ->{&#xA;            videoService.streamVideo(os);&#xA;        };&#xA;        return new ResponseEntity&lt;>(responseStream, headers, HttpStatus.PARTIAL_CONTENT);&#xA;    }&#xA;</streamingresponsebody>

    &#xA;

    When I open the /stream I get an error on spring application

    &#xA;

    "ServletOutputStream failed to flush : java.io.IOException : An established connection was aborted by the software in your host machine"

    &#xA;

      &#xA;
    • On firefox in console I got 2 errors&#xA;Cant decode multimedia resource :&#xA;And Cant decode multimedia resource:Error Code : NS_ERROR_DOM_MEDIA_METADATA_ERR (0x806e0006)&#xA;And the window which video will be showing says "No video with supported format and MIME type found"

      &#xA;

    • &#xA;

    • On Chrome just nothing happens

      &#xA;

    • &#xA;

    • And on firefox when i open the view-source i see the stream information and then there is jibberish which i suppose are bytes from the video the. The jibberish stops when i got the ServletOutputStream failed to flush : in console in Spring

      &#xA;

    • &#xA;

    &#xA;

    Sorry if error codes translation is hard to understand

    &#xA;