
Recherche avancée
Médias (2)
-
GetID3 - Bloc informations de fichiers
9 avril 2013, par
Mis à jour : Mai 2013
Langue : français
Type : Image
-
GetID3 - Boutons supplémentaires
9 avril 2013, par
Mis à jour : Avril 2013
Langue : français
Type : Image
Autres articles (77)
-
Les autorisations surchargées par les plugins
27 avril 2010, parMediaspip core
autoriser_auteur_modifier() afin que les visiteurs soient capables de modifier leurs informations sur la page d’auteurs -
Publier sur MédiaSpip
13 juin 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 -
List of compatible distributions
26 avril 2011, parThe table below is the list of Linux distributions compatible with the automated installation script of MediaSPIP. Distribution nameVersion nameVersion number Debian Squeeze 6.x.x Debian Weezy 7.x.x Debian Jessie 8.x.x Ubuntu The Precise Pangolin 12.04 LTS Ubuntu The Trusty Tahr 14.04
If you want to help us improve this list, you can provide us access to a machine whose distribution is not mentioned above or send the necessary fixes to add (...)
Sur d’autres sites (7742)
-
Getting Error message Unknown encoder 'libx264' , any help appreciated
16 janvier 2022, par Alex.FosterI am trying to compress videos files to a target size within python using ffmpeg-python for an A level project as part of my coursework, I keep getting this error saying it doesn't know the encoder. Not sure what I'm meant to do as this is literally an entirely new space to me. Am I meant to have installed the codec or something, or is there an alternative I can use ?


import os, ffmpeg
##import section:this part is where I import all of the modules I will use
import tkinter
import shutil
from tkinter import filedialog
import os


def fileSelect(): #start of fileSelect function
 global startingLocation #declares startingLocation as global variable
 global originalName #declares originalName as global variable
 global fileType #declares fileType as global variable
 startingLocation = filedialog.askopenfilename(initialdir="/", title="Select file", #tkinter function that opens file explorer, lets user select file saves the file path as a variable
 filetypes=(("video files", "*.mp4"),("images", "*.jpg*")))
 originalName = os.path.basename(startingLocation) #os function that gets the actaul file name from the path string
 print (originalName) #print statement to check if originalName has been found
 fileType = startingLocation.split('.') #splits original name where any full stop in found and saves array as variable
 fileType = fileType[-1] #changes variable to have the str value of the final item in the array; the file type
 fileType = '.' + fileType #adds fullstop to the start of the file type so i dont have to repeatedly do it
 print (fileType) #print statement to check file type is found correctly

def outputSelect(): #start of outputSelect function
 global outputLocation #declares outputLocation as global variable
 outputLocation = filedialog.askdirectory(initialdir="/", title="Select folder") #tkinter function that opens file explorer, lets the user select of folder as saves the folder path as a variable

def fileNewName(): #start of fileNewName function
 global customName #declares customName as global variable
 customName = input("Enter the end name of your file") #simple code assigning user input to the custom name vairable
 customName = customName + fileType #add the fileType onto the end of the custom name

def compress(): #start of compress function
 fileSelect() #calls the fileSelect function
 outputSelect() #calls the outputSelect function
 fileNewName()
 global src
 global dst #calls the fileNewName function
 src = startingLocation #assigns startingLocation str as src, so the shutil module is able to use it in a cleaner way
 dst = outputLocation #assigns outputLocation dst as src, so the shutil module is able to use it in a cleaner way
 shutil.copy(src, dst) #shutil command that copies the file from src to dst
 src = outputLocation + '/' + originalName #reassigns src as the location of the file copy
 dst = outputLocation + '/' + customName #reassigns dst as the location of the file copy but with a new name
 shutil.move(src,dst)


def compress_video(video_full_path, output_file_name, target_size):
 # Reference: https://en.wikipedia.org/wiki/Bit_rate#Encoding_bit_rate
 min_audio_bitrate = 32000
 max_audio_bitrate = 256000

 probe = ffmpeg.probe(video_full_path)
 # Video duration, in s.
 duration = float(probe['format']['duration'])
 # Audio bitrate, in bps.
 audio_bitrate = float(next((s for s in probe['streams'] if s['codec_type'] == 'audio'), None)['bit_rate'])
 # Target total bitrate, in bps.
 target_total_bitrate = (target_size * 1024 * 8) / (1.073741824 * duration)

 # Target audio bitrate, in bps
 if 10 * audio_bitrate > target_total_bitrate:
 audio_bitrate = target_total_bitrate / 10
 if audio_bitrate < min_audio_bitrate < target_total_bitrate:
 audio_bitrate = min_audio_bitrate
 elif audio_bitrate > max_audio_bitrate:
 audio_bitrate = max_audio_bitrate
 # Target video bitrate, in bps.
 video_bitrate = target_total_bitrate - audio_bitrate

 i = ffmpeg.input(video_full_path)
 ffmpeg.output(i, os.devnull,
 **{'c:v': 'libx264', 'b:v': video_bitrate, 'pass': 1, 'f': 'mp4'}
 ).overwrite_output().run()
 ffmpeg.output(i, output_file_name,
 **{'c:v': 'libx264', 'b:v': video_bitrate, 'pass': 2, 'c:a': 'aac', 'b:a': audio_bitrate}
 ).overwrite_output().run()

compress()
compress_video(dst, outputLocation, 3 * 1000)



-
FFMPEG stream video to Youtube Live
13 juin 2022, par BlessedHITI have a mov file and I'm using ffmpeg to stream it to youtube live using the following command,


ffmpeg -re -i "episode.mov" -pix_fmt yuvj420p -x264-params keyint=48:min-keyint=48:scenecut=-1 -b:v 4500k -b:a 128k -ar 44100 -acodec aac -vcodec libx264 -preset medium -crf 28 -threads 4 -f flv "rtmp://a.rtmp.youtube.com/live2/YOUTUBE.LIVESTREAM.KEY"



But im getting the following message on youtube,


YouTube is not receiving enough video to maintain smooth streaming. As such, viewers will experience buffering



My ffmpeg output showed my bitrate being between 800 - 1000 mbps, way lower than what i have specified in my ffmpeg command.


I am using a not so powerful virtual machine, and so i thought this might be why i am not getting the desired bitrate.


To overcome my hardware limitations, I then decided to encode the file for streaming using this command :


ffmpeg -i episode.mov -c:v libx264 -preset medium -b:v 4500k -maxrate 4500k -bufsize 6000k -vf "scale=1280:-1,format=yuv420p" -g 50 -c:a aac -b:a 128k -ac 2 -ar 44100 episode.flv



Then I stream copy the file using :


ffmpeg -re -i episode.flv -c copy -f flv "rtmp://a.rtmp.youtube.com/live2/YOUTUBE.LIVESTREAM.KEY"



And that seems to give me a stream that youtube is happy with.


My question is, is there a way I can rewrite my ffmpeg command to livestream with the desired bitrate without needing to first encode my mov to another file or is adding more memory the only way forward here ?


-
Concatenate multiple video files alongside delayed audio files
28 mars 2022, par Spartan 117I am currently working on a utility that is responsible for pulling audio and video files from the cloud and merging them together via FFMPEG. As I am new to FFMPEG, I am going to split the question into an FFMPEG part and a C# part just so people can answer either 1 part or the other (or both !).


FFMPEG Part


Currently, I have a working FFMPEG arg if there is only 1 video file present and it needs to be merged with multiple files.


ffmpeg -i input1.mkv -i input1.mka -i input2.mka -i input3.mka -i input4.mka -filter_complex "[1:a]adelay=0s:all=1[a1pad];[2:a]adelay=20s:all=1[a2pad];[3:a]adelay=30s:all=1[a3pad];[4:a]adelay=40s:all=1[a4pad];[a1pad][a2pad][a3pad][a4pad]amix=inputs=4:weights=1|1|1|1[aout]" -map [aout] -map 0:0 output4.mkv



The delays you see in there are determined by subtracting the start time of each file from the start time of the earliest created audio or video file. I know that if I wanted to create a horizontal stack of multiple videos, i could just do


ffmpeg -i input1.mkv -i input1.mka -i input2.mkv -i input2.mka -i input3.mka -i input4.mka
-filter_complex 
"[2:v]tpad=start_duration=120:color=black[vpad]; 
 [3:a]adelay=120000:all=1[a2pad]; 
 [4:a]adelay=180000:all=1[a3pad];
 [5:a]adelay=200000:all=1[a4pad]; 
 [0:v][vpad]hstack=inputs=2[vout]; 
 [1:a][a2pad][a3pad][a4pad]amix=inputs=4:weights=1|1|1|1[aout]" 
 -map [vout] -map [aout] 
 output.mkv



but what I want to do is both keep those delays for the audio and video files AND concatenate (not stack) those videos, how would i go about doing that ?


C# Part


You see that giant arg up there ? The utility is supposed to generate that based on a List of recordings. Here is the model.


List<filemodel> _records;
public class FileModel {
 public string Id { get; set; }
 public string FileType { get; set; }
 public string StartTime { get; set; }
}
</filemodel>


The utility has to then go through that list and create the arg (as seen in the FFMPEG part) to be executed by the Xabe.FFMPEG package. The way i was thinking to approach this is to basically create 2 string builders. 1 string builder will be responsible for dealing with the inputs, the other string builder. Here is what i have so far


private async Task CombineAsync()
 {
 var minTime = _records.Min(y => Convert.ToDateTime(y.StartTime));
 var frontBuilder = new StringBuilder("-y ");
 var middleBuilder = new StringBuilder("-filter_complex \"");
 var endString = $" -map [vout] -map [aout] {_folderPath}\\CombinedOutput.mkv";

 for (var i = 0; i < _records.Count; i++)
 {
 var type = _records[i].FileType.ToLower();
 var delay = (Convert.ToDateTime(_records[i].StartTime).Subtract(minTime)).TotalSeconds;
 frontBuilder.Append($"-i {_folderPath + "\\" + _records[i].Id} ");
 var addColon = i != _records.Count - 1 ? ";" : "";
 middleBuilder.Append(type.Equals("video") ? $"[{i}:v]tpad=start_duration={delay}:color=black[v{i}pad]{addColon} " : $"[{i}:a]adelay={delay}s:all=1[a{i}pad]{addColon} ");
 }
 middleBuilder.Append("\"");
 Console.WriteLine(frontBuilder.ToString() + middleBuilder.ToString() + endString);
 // var args = frontBuilder + middleBuilder + endString;
 // try
 // {
 // var conversionResult = await FFmpeg.Conversions.New().Start(args);
 // Console.WriteLine(JsonConvert.SerializeObject(conversionResult));
 // }
 // catch (Exception e)
 // {
 // Console.WriteLine(e);
 // }
 }



- 

-
Is this the correct way to go about building the argument out ?


-
How in god's name do i get something like this in there, since it relies on naming and total count for the piping and inputs=


[0:v][vpad]hstack=inputs=2[vout]; // This part will change for video concatenation depending on what gets answered above
 [1:a][a2pad][a3pad][a4pad]amix=inputs=4:weights=1|1|1|1[aout]









-