
Advanced search
Medias (1)
-
The Slip - Artworks
26 September 2011, by
Updated: September 2011
Language: English
Type: Text
Other articles (74)
-
Le plugin : Podcasts.
14 July 2010, byLe problème du podcasting est à nouveau un problème révélateur de la normalisation des transports de données sur Internet.
Deux formats intéressants existent : Celui développé par Apple, très axé sur l’utilisation d’iTunes dont la SPEC est ici; Le format "Media RSS Module" qui est plus "libre" notamment soutenu par Yahoo et le logiciel Miro;
Types de fichiers supportés dans les flux
Le format d’Apple n’autorise que les formats suivants dans ses flux : .mp3 audio/mpeg .m4a audio/x-m4a .mp4 video/mp4 (...) -
Configurer la prise en compte des langues
15 November 2010, byAccéder à la configuration et ajouter des langues prises en compte
Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...) -
Publier sur MédiaSpip
13 June 2013Puis-je poster des contenus à partir d’une tablette Ipad ?
Oui, si votre Médiaspip installé est à la version 0.2 ou supérieure. Contacter au besoin l’administrateur de votre MédiaSpip pour le savoir
On other websites (10717)
-
I have a m3u8 file where the individual files don't have any .ts format, Is there a way to cocnat them to a single mp4 file
6 September 2020, by Suhail HussainHere is a snippet of the m3u8 file


#EXTM3U
#EXTINF:1,0
0
#EXTINF:1695,0c9c3bf590e32dcb8c4b83222056838b
0c9c3bf590e32dcb8c4b83222056838b
#EXTINF:1,1
1
#EXTINF:4,2
2
#EXTINF:3,3
3
#EXTINF:4,4
4
#EXTINF:3,5
5
#EXTINF:3,6
6
#EXTINF:4,7
7
#EXTINF:4,8
8
#EXTINF:3,9
9
#EXTINF:4,10
10



This goes on for some 500 files. I am able to open the folder in vlc as a playlist but it is just a collection of 500 files that play one after the another. I checked online and found that ffmpeg can concatenate a m3u8 file to a mp4. That unfortunately did not work. After trying a few different syntaxes that I found on different forums which also did not work, I tried "ffplay" on the file name which once again gave the same error message as before -
Invalid data found when processing input:= 0B f=0/0


So this made me believe perhaps ffmpeg is unable to open the file while vlc is able to. Any way to combine these files to a single file is appreciated


-
FFmpeg batch file - combine individual set files with randomized selection from another set of files
4 August 2018, by SiampuI need to combine a specific set of files with a randomized selection from another set of files; for more specific context, voice clips followed by a randomized walky-talky beep. At the moment, I’ve managed to assemble this so far from searching around:
setlocal EnableDelayedExpansion
cd beeps
set n=0
for %%f in (*.*) do (
set /A n+=1
set "file[!n!]=%%f"
)
set /A "rand=(n*%random%)/32768+1"
cd ..
for %%A IN (*.ogg) DO ffmpeg -y -i radio_beep.wav -i "%%A" -i "beeps\!file[%rand%]!" -filter_complex "[0:a:0][1:a:0][2:a:0]concat=n=3:v=0:a=1[outa]" -map "[outa]" "helper\%%A"At the moment, this will only run the randomization once and use that selection for every file. How can I have it do the randomization for each .ogg in the folder, and get that into FFmpeg as an input?
-
On-demand and seamless transcoding of individual HLS segments
5 January 2024, by Omid AriyanBackground


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)
{
 int timeout = 30000;
 int totalWaitTime = 0;
 int waitInterval = 100;
 byte[] output = Array.Empty<byte>();
 string executable = "/opt/homebrew/bin/ffmpeg";
 DirectoryInfo temp = Directory.CreateDirectory(System.IO.Path.Combine(System.IO.Path.GetTempPath(), System.IO.Path.GetRandomFileName()));
 string format = System.IO.Path.Combine(temp.FullName, "output-%05d.ts");

 using (Process ffmpeg = new())
 {
 ffmpeg.StartInfo.FileName = executable;

 ffmpeg.StartInfo.Arguments = String.Format("-ss {0} ", index * duration);
 ffmpeg.StartInfo.Arguments += String.Format("-y -t {0} ", duration);
 ffmpeg.StartInfo.Arguments += String.Format("-i \"{0}\" ", path);
 ffmpeg.StartInfo.Arguments += String.Format("-c:v libx264 -c:a aac ");
 ffmpeg.StartInfo.Arguments += String.Format("-segment_time {0} -reset_timestamps 1 -break_non_keyframes 1 -map 0 ", duration);
 ffmpeg.StartInfo.Arguments += String.Format("-initial_offset {0} ", index * duration);
 ffmpeg.StartInfo.Arguments += String.Format("-f segment -segment_format mpegts {0}", format);

 ffmpeg.StartInfo.CreateNoWindow = true;
 ffmpeg.StartInfo.UseShellExecute = false;
 ffmpeg.StartInfo.RedirectStandardError = false;
 ffmpeg.StartInfo.RedirectStandardOutput = false;

 ffmpeg.Start();

 do
 {
 Thread.Sleep(waitInterval);
 totalWaitTime += waitInterval;
 }
 while ((!ffmpeg.HasExited) && (totalWaitTime < timeout));

 if (ffmpeg.HasExited)
 {
 string filename = System.IO.Path.Combine(temp.FullName, "output-00000.ts");

 if (!File.Exists(filename))
 {
 throw new FileNotFoundException("Unable to find the generated segment: " + filename);
 }

 output = File.ReadAllBytes(filename);
 }
 else
 {
 // It's been too long. Kill it!
 ffmpeg.Kill();
 }
 }

 // Remove the temporary directory and all its contents.
 temp.Delete(true);

 return output;
}

[HttpGet]
[Route("stream/{id}/{index}.ts")]
public IActionResult Segment(string id, int index)
{
 string path = RetrieveVideoPath(id);
 return File(GenerateVideoOnDemandSegment(index, 10, path), "application/x-mpegURL", true);
}
</byte>


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:


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



The Problem


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?