Recherche avancée

Médias (2)

Mot : - Tags -/map

Autres articles (47)

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

  • Les autorisations surchargées par les plugins

    27 avril 2010, par

    Mediaspip core
    autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs

  • Changer son thème graphique

    22 février 2011, par

    Le thème graphique ne touche pas à la disposition à proprement dite des éléments dans la page. Il ne fait que modifier l’apparence des éléments.
    Le placement peut être modifié effectivement, mais cette modification n’est que visuelle et non pas au niveau de la représentation sémantique de la page.
    Modifier le thème graphique utilisé
    Pour modifier le thème graphique utilisé, il est nécessaire que le plugin zen-garden soit activé sur le site.
    Il suffit ensuite de se rendre dans l’espace de configuration du (...)

Sur d’autres sites (5022)

  • Muting ffmpeg warnings when loading video with OpenCV

    26 mai 2017, par cbuchart

    I’m using OpenCV to process a set of MPEG videos. For some of them following warning is displayed when reading a frame or seeking (it is printed by the ffmpeg library).

    [mpeg2video @ 026b0d20] warning : first frame is no keyframe

    The thing is that such messages are printed together other valid output of my application and they are bothering final users. Is there any way to suppress such warning messages programmatically, other than re-coding the videos with an external tool ?

    I’m already muting the standard output and error, as well as using a custom (dummy) OpenCV error handler. Below a MCVE for testing.

    PS : I understand the warning and actually the full project handles those scenarios so videos are correctly read.


    Example code to reproduce the problem

    #include <iostream>
    #include <opencv2></opencv2>core/core.hpp>
    #include <opencv2></opencv2>highgui/highgui.hpp>

    int handleError(int status, const char* func_name,
                   const char* err_msg, const char* file_name,
                   int line, void* userdata)
    {
     return 0;
    }

    int main()
    {
     std::cout &lt;&lt; "Start!" &lt;&lt; std::endl;

     cv::VideoCapture reader;
     if (!reader.open("Sample.mpg")) {
       std::cout &lt;&lt; "Failed opening video" &lt;&lt; std::endl;
       return 0;
     }

     cv::redirectError(handleError);

     std::cout.setstate(std::ios_base::failbit);
     std::cout &lt;&lt; "std::cout mute test..." &lt;&lt; std::endl; // OK, muted

     std::cerr.setstate(std::ios_base::failbit);
     std::cerr &lt;&lt; "std::cerr mute test..." &lt;&lt; std::endl; // OK, muted

     cv::Mat tmpImage;
     try {
       tmpImage = tmpImage * tmpImage; // OK, OpenCV error muted
     } catch (...) {}

     // Here the warning is printed
     reader.read(tmpImage);

     std::cout.clear();
     std::cerr.clear();
     std::cout &lt;&lt; "Finished!" &lt;&lt; std::endl;

     return 0;
    }
    </iostream>

    The Sample.mpg video can be downloaded from the Internet Archive : https://archive.org/download/ligouHDR-HC1_sample1/Sample.mpg

    This is the current output of the program :

    enter image description here


    I’m using VS 2010 and OpenCV 2.4.10. Following DLLs are the only ones with the executable (no other OpenCV-related DLL is reachable in the PATH).

    • opencv_core2410.dll
    • opencv_ffmpeg2410.dll
    • opencv_highgui2410.dll
  • 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.

    &#xA;

    .net 8 api return :

    &#xA;

        [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;

  • AttributeError : 'FFmpegAudio' object has no attribute '_process' while trying to play audio from URL

    13 août 2022, par jmcamacho7

    I can't find any solution online and I don't know what's wrong.

    &#xA;

    My code is : (Not pasting the URL getting since that works fine)

    &#xA;

    from urllib import parse, request&#xA;import re&#xA;import pafy&#xA;from discord import FFmpegPCMAudio, PCMVolumeTransformer&#xA;&#xA;FFMPEG_OPTIONS = {&#xA;    &#x27;before_options&#x27;: &#x27;-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5&#x27;, &#x27;options&#x27;: &#x27;-vn&#x27;&#xA;}&#xA;&#xA;@bot.command(pass_context=True)&#xA;async def play(ctx, * , search):&#xA;  query_string = parse.urlencode({&#x27;search_query&#x27;: search})&#xA;  html_content = request.urlopen(&#x27;http://www.youtube.com/results?&#x27; &#x2B; query_string)&#xA;  search_results=re.findall(&#x27;watch\?v=(.{11})&#x27;,html_content.read().decode(&#x27;utf-8&#x27;))&#xA;  print(search_results[0])&#xA;  &#xA;  if(ctx.author.voice):&#xA;    channel = ctx.message.author.voice.channel&#xA;    await ctx.send("https://www.youtube.com/watch?v="&#x2B;search_results[0])  &#xA;    url = "https://www.youtube.com/watch?v="&#x2B;search_results[0]&#xA;    conn = await channel.connect()&#xA;    conn.play(discord.FFmpegAudio(url, **FFMPEG_OPTIONS))&#xA;  else:&#xA;    await ctx.send("Necesitas estar en un canal de audio para usar este comando")&#xA;

    &#xA;

    It just gives me this error everytime I try it :

    &#xA;

    Traceback (most recent call last):&#xA;  File "/home/runner/HakuBot/venv/lib/python3.8/site-packages/discord/player.py", line 103, in __del__&#xA;    self.cleanup()&#xA;  File "/home/runner/HakuBot/venv/lib/python3.8/site-packages/discord/player.py", line 154, in cleanup&#xA;    proc = self._process&#xA;AttributeError: &#x27;FFmpegAudio&#x27; object has no attribute &#x27;_process&#x27;&#xA;

    &#xA;

    Anyway to solve this ?

    &#xA;