
Recherche avancée
Médias (1)
-
The Great Big Beautiful Tomorrow
28 octobre 2011, par
Mis à jour : Octobre 2011
Langue : English
Type : Texte
Autres articles (36)
-
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 -
Personnaliser les catégories
21 juin 2013, parFormulaire de création d’une catégorie
Pour ceux qui connaissent bien SPIP, une catégorie peut être assimilée à une rubrique.
Dans le cas d’un document de type catégorie, les champs proposés par défaut sont : Texte
On peut modifier ce formulaire dans la partie :
Administration > Configuration des masques de formulaire.
Dans le cas d’un document de type média, les champs non affichés par défaut sont : Descriptif rapide
Par ailleurs, c’est dans cette partie configuration qu’on peut indiquer le (...) -
Support audio et vidéo HTML5
10 avril 2011MediaSPIP utilise les balises HTML5 video et audio pour la lecture de documents multimedia en profitant des dernières innovations du W3C supportées par les navigateurs modernes.
Pour les navigateurs plus anciens, le lecteur flash Flowplayer est utilisé.
Le lecteur HTML5 utilisé a été spécifiquement créé pour MediaSPIP : il est complètement modifiable graphiquement pour correspondre à un thème choisi.
Ces technologies permettent de distribuer vidéo et son à la fois sur des ordinateurs conventionnels (...)
Sur d’autres sites (8963)
-
RUN FFMPEG IN PYTHON
7 janvier 2023, par SMARTI have 1 video & 1 audio.


video's duration : 4s


audio's duration : 7.48 s


i wrote python function to combine these files


MY CODE :


import subprocess as sp

 def runffmpeg(cmd):
 try:
 pipe = sp.Popen(cmd, stdout=sp.PIPE, stderr=sp.STDOUT,
 universal_newlines=True)
 
 ffmpeg_output, _ = pipe.communicate()
 
 print(ffmpeg_output)
 return (ffmpeg_output)
 
 except sp.CalledProcessError as err:
 print("FFmpeg stdout output on error:\n" + err.output)
 
 def get_duration(fn):
 cmd = (
 f"ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 {fn}")
 
 cmd1 = (
 f"ffprobe -v error -of flat=s_ -select_streams 1 -show_entries stream=duration -of default=noprint_wrappers=1:nokey=1 {fn}")
 try:
 pipe = sp.Popen(cmd, stdout=sp.PIPE, stderr=sp.STDOUT,
 universal_newlines=True)
 
 viddur, _ = pipe.communicate()
 
 print(viddur)
 
 pipe = sp.Popen(cmd1, stdout=sp.PIPE, stderr=sp.STDOUT,
 universal_newlines=True)
 
 auddur, _ = pipe.communicate()
 
 try:
 auddur = float(auddur.strip())
 except:
 auddur = 0
 
 print(auddur)
 
 # if (len(auddur) == 0):
 # auddur = 0
 
 return float(viddur.strip()), (auddur)
 
 except sp.CalledProcessError as err:
 print("FFmpeg stdout output on error:\n" + err.output)
 

def set_audio_to_video(vn, an, output):

 vdur, adur = get_duration(fn=vn)
 print(f" video duration is {vdur}")

 auddur, adur = get_duration(fn=an)
 print(f" audio duration is {auddur}")

 #cmd = (f" ffmpeg -i {vn} -i {an} -filter_complex \"[0:v]setpts=PTS*{auddur}/{vdur} [v];atempo={auddur}/{vdur} [a]\" -map \"[v]\" -map 1:a -shortest -y {output}")

cmd = (
 f" ffmpeg -i {vn} -i {an} -filter_complex \"[0:v]setpts=PTS*{auddur}/{vdur} [v]\" -map \"[v]\" -map 1:a -shortest -pix_fmt yuv420p -y {output}")
print(cmd)

x = runffmpeg(cmd=cmd)



to call the function :
set_audio_to_video(vn="cremovie.mp4", an="a1.wav", output="output.mp4")


i'm getting error :


Traceback (most recent call last):
 File "e:\MOVIEPY\FFMPEG-PYTHON.py", line 439, in <module>
 set_audio_to_video(vn="cremovie.mp4", an="a1.wav", output="output.mp4")
 File "e:\MOVIEPY\FFMPEG-PYTHON.py", line 424, in set_audio_to_video
 x = runffmpeg(cmd=cmd)
 File "e:\MOVIEPY\FFMPEG-PYTHON.py", line 399, in runffmpeg
 pipe = sp.Popen(cmd, stdout=sp.PIPE, stderr=sp.STDOUT,
 File "C:\Python39\lib\subprocess.py", line 947, in __init__
 self._execute_child(args, executable, preexec_fn, close_fds,
 File "C:\Python39\lib\subprocess.py", line 1416, in _execute_child
 hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
 OSError: [WinError 87] The parameter is incorrect
</module>


final command generated by function will look like :


ffmpeg -i cremovie.mp4 -i a1.wav -filter_complex "[0:v]setpts=PTS*7.489116/4.0 [v]" -map "[v]" -map 1:a -shortest -pix_fmt yuv420p -y output.mp4



i want to extend the video's duration to audio's duration ( video's duration increased to from 4s to 7.48 s)


while running this ffmpeg command in command prompt (CMD) , its working , got no errors but in python , i'm getting errors.


SYSTEM DETAILS :
WINDOWS 10 64 BITS
PYTHON 3.9 64 BITS


WHAT TO DO ?


-
Perl and ffmpeg script
21 novembre 2016, par armight29The first part of my script that asks whether to check for cinavia doesn’t work. That is, if I type in ’y’ or ’Y’ it doesn’t proceed to the
CNVIACHk
function but goes instead to theMVIEPARAMs
function.# GET FILE INPUT..
print "Enter Filename..";
my $MOVIe = <stdin>;
print "Check For Cinavia? Enter y or n\n";
my $CNVIAQUESt = <stdin>;
if ( $CNVIAQUESt eq "y" || $CNVIAQUESt eq "Y" ) {
CNVIACHk( $MOVIe );
}
else {
MVIEPARAMs( $MOVIe );
}
sub MVIEPARAMs {
system(
"ffprobe -v error -show_entries format=duration -of default=noprint_wrappers=1:nokey=1 $MOVIe"
);
print "Duration In Seconds..";
$DURATIOn = <stdin>;
system(
'ffprobe -v error -of flat=s=_ -select_streams v:0 -show_entries stream=height,width "$MOVIe"'
);
print "Movie Width? ";
$MOVIEWIDTh = <stdin>;
print "Movie Height? ";
$MOVIEHEIGHt = <stdin>;
print "Enter Target Width.. ";
$TARGETWIDTh = <stdin>;
print "Enter Target Height.. ";
$TARGETHEIGHt = <stdin>;
system(
'ffprobe -show_entries stream=index,codec_type:stream_tags=language -of compact "$MOVIe" -v 0 | grep eng'
);
print "Enter number of English Audio Track.. ";
$ENGAUDTRk = <stdin>;
print "English Audio Track Number Is ", $ENGAUDTRk, ".";
$BTRTe = 31875072 / $DURATIOn;
DETRMNEPAd;
}
sub DETRMNEPAd {
if ( $MOVIEWIDTh < $TARGETWIDTh ) {
$X = $TARGETWIDTh - $MOVIEWIDTh / 2;
}
elsif ( $MOVIEHEIGHt < $TARGETHEIGHt ) {
$Y = $TARGETHEIGHt - $MOVIEHEIGHt / 2;
$X = 0;
print $Y;
}
else {
print "Padding Not Needed Moving On...";
CNVRTWOPAd();
}
CNVRTWPAd();
}
sub CNVIACHk {
print "Checking Movie For Cinavia.. ";
system( "cinde -i $MOVIe -q high -l" );
print "Enter Track To Check.. ";
$TRKTOCHEk = <stdin>;
system( "cinde -i $MOVIe -q high -t $TRKTOCHEk" );
print "Was Cinavia Detected?";
$CNVIACHKANSr = <stdin>;
if ( $CNVIACHKANSr eq "y" ) {
exit;
}
else {
print "Would You Like To Check Another Track?";
$CHKANTHRTRk = <stdin>;
if ( $CHKANTHRTRk eq "y" ) {
CNVIACHk();
}
else {
MVIEPARAMs();
}
}
}
sub CNVRTWOPAd {
print "BEGINNING CONVERSION...\n";
print "What Preset Would You Like To Use?";
$PRESEt = <stdin>;
system(
"ffmpeg -i $MOVIe -map 0:0 -map 0:$ENGAUDTRk -c:v libx264 -b:v $BTRTe -preset $PRESEt -strict -2 -c:a ac3 -b:a 192k -threads 12 -pass 1 -f matroska dummy && ",
"ffmpeg -i $MOVIe -map 0:0 -map 0:$ENGAUDTRk -c:v libx264 -b:v $BTRTe -preset $PRESEt -strict -2 -c:a ac3 -b:a 192k -threads 12 -pass 2 -f matroska ENCODE1.mkv"
);
}
sub CNVRTWPAd {
print "BEGINNING CONVERSION...\n";
print "What Preset Would You Like To Use?";
my $PRESEt = <stdin>;
system(
"ffmpeg -i $MOVIe -map 0:0 -map 0:$ENGAUDTRk -c:v libx264 -b:v $BTRTe -preset $PRESEt -vf \"pad=$TARGETWIDTh:$TARGETHEIGHt:$X:$Y:black\" -strict -2 -c:a ac3 -b:a 192k ",
" -threads 12 -pass 1 -f matroska dummy && ffmpeg -i $MOVIe -map 0:0 -map 0:$ENDAUDTRk -c:v libx264 -b:v $BTRTe -preset $PRESEt -vf \"pad=$TARGETWIDTh:$TARGETHEIGHt:$X:$Y:black\"",
" -strict -2 -c:a ac3 -b:a 192k -threads 12 -pass 2 -f matroska ENCODE1.mkv"
);
}
</stdin></stdin></stdin></stdin></stdin></stdin></stdin></stdin></stdin></stdin></stdin></stdin></stdin> -
ffmpeg joinnig videos in php linux
28 octobre 2013, par user2226181I am trying to add joining videos with no audio in ffmpeg php using linux operating system. My code is this :
cat output_1.mp4 output_2.mp4 output_3.mp4 output_4.mp4 > final.mp4
It is giving me an output of
final.mp4
in result but there is a problem in thefinal.mp4
there is only first video which isoutput_1.mp4
in final video, the other videos are not being concatenate. Please help me in this case.Thanks