Recherche avancée

Médias (0)

Mot : - Tags -/content

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (38)

  • Websites made ​​with MediaSPIP

    2 mai 2011, par

    This page lists some websites based on MediaSPIP.

  • Qu’est ce qu’un éditorial

    21 juin 2013, par

    Ecrivez votre de point de vue dans un article. Celui-ci sera rangé dans une rubrique prévue à cet effet.
    Un éditorial est un article de type texte uniquement. Il a pour objectif de ranger les points de vue dans une rubrique dédiée. Un seul éditorial est placé à la une en page d’accueil. Pour consulter les précédents, consultez la rubrique dédiée.
    Vous pouvez personnaliser le formulaire de création d’un éditorial.
    Formulaire de création d’un éditorial Dans le cas d’un document de type éditorial, les (...)

  • Creating farms of unique websites

    13 avril 2011, par

    MediaSPIP platforms can be installed as a farm, with a single "core" hosted on a dedicated server and used by multiple websites.
    This allows (among other things) : implementation costs to be shared between several different projects / individuals rapid deployment of multiple unique sites creation of groups of like-minded sites, making it possible to browse media in a more controlled and selective environment than the major "open" (...)

Sur d’autres sites (5133)

  • RTSP streaming on Android client using FFMpeg

    10 août 2013, par rurtle

    I am working on a hobby project the goal for which is to develop an Android application capable of streaming live feeds captured through web cams in a LAN setting using FFMpeg as the underlying engine. So far, I did the following -

    A. Compiling and generating FFMpeg related libraries for the following releases -

    FFMpeg version : 2.0
    NDK version : r8e & r9
    Android Platform version : android-16 & android-18thisthisthisthis
    Toolchain version : 4.6 & 4.8
    Platform built on : Fedora 18 (x86_64)

    B. Creating the files Android.mk & Application.mk in appropriate path.

    However, when it came to writing the native code for accessing appropriate functionality of FFMpeg from the application layer using Java, I'm stuck with following questions -

    a) Which all of FFMpeg's features I need to make available from native to app layer for streaming real-time feeds ?
    b) In order to compile FFMpeg for Android, I followed this link. Whether the compilation options are sufficient for handling *.sdp streams or do I need to modify it ?
    c) Do I need to make use of live555 ?

    I am totally new to FFMpeg and Android application development and this is going to be my first serious project for Android platform. I have been searching for relevant tutorials dealing with RTSP streaming using FFMpeg for a while now without much success. Moreover, I tried the latest development build of VLC player and found it to be great for streaming real-time feeds. However, it's a complex beast and the goal for my project is of quite limited nature, mostly learning - in a short time span.

    Could you suggest some pointers (e.g. links, documents or sample code) on how can I write the native code for utilizing FFMpeg library and subsequently use those functionality from the app layer for streaming real-time feeds ? Moreover, will really appreciate if you could let me know the kind of background knowledge necessary for this project from a functional standpoint (in a language agnostic sense).

  • Concat video files using ffmpeg in individual subfolders with shell script [closed]

    18 août 2022, par Weatherdark

    I had a Windows script that would do what I want, but I switched my server to Unraid so now I need a new script. Anyway, enough backstory.

    


    I regularly have media that is named in a style like "Videoname CD(Number).ext". They get stored in subfolders called Videoname with a different folder for each video.

    


    What I need is a script that goes through each subfolder and creates a concat.txt file with the names of each video file ending in CD(number) in it, in numerical order, that will then call ffmpeg to concat the files using the concat.txt in each subfolder, placing the video file (named after the subfolder) into a folder like /mnt/User/Pool/Finished/Videofile. Then, hopefully it will delete the concat.txt file so I know which folders are finished with a quick look.

    


    I know the ffmpeg concat options for that part, I just have no idea what to use to make sure the resulting video file is named after the subfolder it came from.

    


    I could do this in Windows (albeit in a hacky, not very pretty way), but I have no idea how to accomplish this in Linux.

    


    As an example...

    


    


    /mnt/User/Pool/Concat/10.10.2022.0034.Recording/10.10.2022.0034.Recording
CD1.mp4
/mnt/User/Pool/Concat/10.10.2022.0034.Recording/10.10.2022.0034.Recording
CD2.mp4
/mnt/User/Pool/Concat/10.10.2022.0034.Recording/10.10.2022.0034.Recording
CD3.mp4
/mnt/User/Pool/Concat/10.10.2022.0034.Recording/10.10.2022.0034.Recording
CD4.mp4
/mnt/User/Pool/Concat/10.11.2022.0254.Recording/10.11.2022.0254.Recording
CD1.mp4
/mnt/User/Pool/Concat/10.11.2022.0254.Recording/10.11.2022.0254.Recording
CD2.mp4
/mnt/User/Pool/Concat/10.11.2022.0254.Recording/10.11.2022.0254.Recording
CD3.mp4
/mnt/User/Pool/Concat/10.11.2022.0254.Recording/10.11.2022.0254.Recording
CD4.mp4

    


    Put through ffmpeg to concat, results in files

    


    /mnt/User/Pool/Finished/10.10.2022.0034.Recording.mp4

    


    /mnt/User/Pool/Finished/10.11.2022.0254.Recording.mp4

    


    


    Hopefully that makes sense.

    


    Someone closed this because it wasn't "focused enough" and didn't focus on one thing... but there is ONLY one thing that it needs to do.

    


    I have no idea what they would want me to change to fix what isn't broken, so I fundamentally am at a loss. The script just needs to search through subfolders, create a concat.txt file and send that file to ffmpeg creating the new file, named after the folder, in a new location. That is literally as focused as I can make it.

    


  • On-demand and seamless transcoding of individual HLS segments

    5 janvier 2024, par Omid Ariyan

    Background

    


    I've been meaning to implement on-demand transcoding of certain video formats such as ".mkv", ".wmv", ".mov", etc. in order to serve them on a media management server using ASP.NET Core 6.0, C# and ffmpeg.

    


    My Approach

    


    The approach I've decided to use is to serve a dynamically generated .m3u8 file which is simply generated using a segment duration of choice e.g. 10s and the known video duration. Here's how I've done it. Note that the resolution is currently not implemented and discarded :

    


    public string GenerateVideoOnDemandPlaylist(double duration, int segment)
{
   double interval = (double)segment;
   var content = new StringBuilder();

   content.AppendLine("#EXTM3U");
   content.AppendLine("#EXT-X-VERSION:6");
   content.AppendLine(String.Format("#EXT-X-TARGETDURATION:{0}", segment));
   content.AppendLine("#EXT-X-MEDIA-SEQUENCE:0");
   content.AppendLine("#EXT-X-PLAYLIST-TYPE:VOD");
   content.AppendLine("#EXT-X-INDEPENDENT-SEGMENTS");

   for (double index = 0; (index * interval) < duration; index++)
   {
      content.AppendLine(String.Format("#EXTINF:{0:#.000000},", ((duration - (index * interval)) > interval) ? interval : ((duration - (index * interval)))));
      content.AppendLine(String.Format("{0:00000}.ts", index));
   }

   content.AppendLine("#EXT-X-ENDLIST");

   return content.ToString();
}

[HttpGet]
[Route("stream/{id}/{resolution}.m3u8")]
public IActionResult Stream(string id, string resolution)
{
   double duration = RetrieveVideoLengthInSeconds();
   return Content(GenerateVideoOnDemandPlaylist(duration, 10), "application/x-mpegURL", Encoding.UTF8);
}


    


    Here's an example of how the .m3u8 file looks like :

    


    #EXTM3U
#EXT-X-VERSION:6
#EXT-X-TARGETDURATION:10
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-PLAYLIST-TYPE:VOD
#EXT-X-INDEPENDENT-SEGMENTS
#EXTINF:10.000000,
00000.ts
#EXTINF:3.386667,
00001.ts
#EXT-X-ENDLIST


    


    So the player would ask for 00000.ts, 00001.ts, etc. and the next step is to have them generated on demand :

    


    public byte[] GenerateVideoOnDemandSegment(int index, int duration, string path)&#xA;{&#xA;   int timeout = 30000;&#xA;   int totalWaitTime = 0;&#xA;   int waitInterval = 100;&#xA;   byte[] output = Array.Empty<byte>();&#xA;   string executable = "/opt/homebrew/bin/ffmpeg";&#xA;   DirectoryInfo temp = Directory.CreateDirectory(System.IO.Path.Combine(System.IO.Path.GetTempPath(), System.IO.Path.GetRandomFileName()));&#xA;   string format = System.IO.Path.Combine(temp.FullName, "output-%05d.ts");&#xA;&#xA;   using (Process ffmpeg = new())&#xA;   {&#xA;      ffmpeg.StartInfo.FileName = executable;&#xA;&#xA;      ffmpeg.StartInfo.Arguments = String.Format("-ss {0} ", index * duration);&#xA;      ffmpeg.StartInfo.Arguments &#x2B;= String.Format("-y -t {0} ", duration);&#xA;      ffmpeg.StartInfo.Arguments &#x2B;= String.Format("-i \"{0}\" ", path);&#xA;      ffmpeg.StartInfo.Arguments &#x2B;= String.Format("-c:v libx264 -c:a aac ");&#xA;      ffmpeg.StartInfo.Arguments &#x2B;= String.Format("-segment_time {0} -reset_timestamps 1 -break_non_keyframes 1 -map 0 ", duration);&#xA;      ffmpeg.StartInfo.Arguments &#x2B;= String.Format("-initial_offset {0} ", index * duration);&#xA;      ffmpeg.StartInfo.Arguments &#x2B;= String.Format("-f segment -segment_format mpegts {0}", format);&#xA;&#xA;      ffmpeg.StartInfo.CreateNoWindow = true;&#xA;      ffmpeg.StartInfo.UseShellExecute = false;&#xA;      ffmpeg.StartInfo.RedirectStandardError = false;&#xA;      ffmpeg.StartInfo.RedirectStandardOutput = false;&#xA;&#xA;      ffmpeg.Start();&#xA;&#xA;      do&#xA;      {&#xA;         Thread.Sleep(waitInterval);&#xA;         totalWaitTime &#x2B;= waitInterval;&#xA;      }&#xA;      while ((!ffmpeg.HasExited) &amp;&amp; (totalWaitTime &lt; timeout));&#xA;&#xA;      if (ffmpeg.HasExited)&#xA;      {&#xA;         string filename = System.IO.Path.Combine(temp.FullName, "output-00000.ts");&#xA;&#xA;         if (!File.Exists(filename))&#xA;         {&#xA;            throw new FileNotFoundException("Unable to find the generated segment: " &#x2B; filename);&#xA;         }&#xA;&#xA;         output = File.ReadAllBytes(filename);&#xA;      }&#xA;      else&#xA;      {&#xA;         // It&#x27;s been too long. Kill it!&#xA;         ffmpeg.Kill();&#xA;      }&#xA;   }&#xA;&#xA;   // Remove the temporary directory and all its contents.&#xA;   temp.Delete(true);&#xA;&#xA;   return output;&#xA;}&#xA;&#xA;[HttpGet]&#xA;[Route("stream/{id}/{index}.ts")]&#xA;public IActionResult Segment(string id, int index)&#xA;{&#xA;   string path = RetrieveVideoPath(id);&#xA;   return File(GenerateVideoOnDemandSegment(index, 10, path), "application/x-mpegURL", true);&#xA;}&#xA;</byte>

    &#xA;

    So as you can see, here's the command I use to generate each segment incrementing -ss and -initial_offset by 10 for each segment :

    &#xA;

    ffmpeg -ss 0 -y -t 10 -i "video.mov" -c:v libx264 -c:a aac -segment_time 10 -reset_timestamps 1 -break_non_keyframes 1 -map 0 -initial_offset 0 -f segment -segment_format mpegts /var/folders/8h/3xdhhky96b5bk2w2br6bt8n00000gn/T/4ynrwu0q.z24/output-%05d.ts&#xA;

    &#xA;

    The Problem

    &#xA;

    Things work on a functional level, however the transition between segments is slightly glitchy and especially the audio has very short interruptions at each 10 second mark. How can I ensure the segments are seamless ? What can I improve in this process ?

    &#xA;