
Recherche avancée
Médias (1)
-
Rennes Emotion Map 2010-11
19 octobre 2011, par
Mis à jour : Juillet 2013
Langue : français
Type : Texte
Autres articles (111)
-
Script d’installation automatique de MediaSPIP
25 avril 2011, parAfin de palier aux difficultés d’installation dues principalement aux dépendances logicielles coté serveur, un script d’installation "tout en un" en bash a été créé afin de faciliter cette étape sur un serveur doté d’une distribution Linux compatible.
Vous devez bénéficier d’un accès SSH à votre serveur et d’un compte "root" afin de l’utiliser, ce qui permettra d’installer les dépendances. Contactez votre hébergeur si vous ne disposez pas de cela.
La documentation de l’utilisation du script d’installation (...) -
Ajouter des informations spécifiques aux utilisateurs et autres modifications de comportement liées aux auteurs
12 avril 2011, parLa manière la plus simple d’ajouter des informations aux auteurs est d’installer le plugin Inscription3. Il permet également de modifier certains comportements liés aux utilisateurs (référez-vous à sa documentation pour plus d’informations).
Il est également possible d’ajouter des champs aux auteurs en installant les plugins champs extras 2 et Interface pour champs extras. -
Gestion générale des documents
13 mai 2011, parMédiaSPIP ne modifie jamais le document original mis en ligne.
Pour chaque document mis en ligne il effectue deux opérations successives : la création d’une version supplémentaire qui peut être facilement consultée en ligne tout en laissant l’original téléchargeable dans le cas où le document original ne peut être lu dans un navigateur Internet ; la récupération des métadonnées du document original pour illustrer textuellement le fichier ;
Les tableaux ci-dessous expliquent ce que peut faire MédiaSPIP (...)
Sur d’autres sites (9033)
-
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 with VP9 + RTSP
4 janvier 2021, par Jim JinWhen we use HEVC + RTSP, ffmpeg works fine. The stream is captured by webcam.


ffmpeg -f dshow -rtbufsize 100M -f vfwcap -i "0" -strict experimental -c:v hevc_qsv -f rtsp -rtsp_transport tcp rtsp://127.0.0.1/live/test



The output is like :


frame= 355 fps= 37 q=-0.0 size=N/A time=00:00:11.27 bitrate=N/A dup=159 drop=0 speed=1.18x



Then we switch to VP9 + RTSP.


ffmpeg -f dshow -rtbufsize 100M -f vfwcap -i "0" -strict experimental -c:v libvpx-vp9 -f rtsp -rtsp_transport tcp rtsp://127.0.0.1/live/test



The fps and speed looks too slow :


frame= 263 fps=9.5 q=0.0 size=N/A time=00:00:07.94 bitrate=N/A dup=119 drop=0 speed=0.288x



Then we use ffplay to play the stream. There are a lot of error messages and the video seems frozen.


[vp9 @ 000001c3da86c200] Not all references are available
[vp9 @ 000001c3dffd5700] Not all references are available
[vp9 @ 000001c3da8477c0] Not all references are available
[vp9 @ 000001c3da848240] Not all references are available
[vp9 @ 000001c3da848e40] Not all references are available
[vp9 @ 000001c3e01d2fc0] Not all references are available
[vp9 @ 000001c3e01dd280] Not all references are available
[vp9 @ 000001c3e01e8980] Not all references are available
[vp9 @ 000001c3e01f1880] Not all references are available
[vp9 @ 000001c3da86c200] Not all references are available
[vp9 @ 000001c3dffd5700] Not all references are available
[vp9 @ 000001c3da8477c0] Not all references are available
[vp9 @ 000001c3da848240] Not all references are available
[vp9 @ 000001c3da848e40] Not all references are available
[vp9 @ 000001c3e01d2fc0] Not all references are available
[vp9 @ 000001c3e01dd280] Not all references are available0B f=0/0
[vp9 @ 000001c3e01e8980] Not all references are available
[vp9 @ 000001c3e01f1880] Not all references are available
[vp9 @ 000001c3da86c200] Not all references are available
[vp9 @ 000001c3dffd5700] Not all references are available
[vp9 @ 000001c3da8477c0] Not all references are available
[vp9 @ 000001c3da848240] Not all references are available
[vp9 @ 000001c3da848e40] Not all references are available
[vp9 @ 000001c3e01d2fc0] Not all references are available
[vp9 @ 000001c3e01dd280] Not all references are available
[vp9 @ 000001c3e01e8980] Not all references are available
[vp9 @ 000001c3e01f1880] Not all references are available



Finally, we try hardware VP9 encoder.


ffmpeg -f dshow -rtbufsize 100M -f vfwcap -i "0" -strict experimental -c:v vp9_qsv -f rtsp -rtsp_transport tcp rtsp://127.0.0.1/live/test



It can't work.


[swscaler @ 0000021e88df9fc0] deprecated pixel format used, make sure you did set range correctly
[vp9_qsv @ 0000021e8687df80] Selected ratecontrol mode is unsupported
[vp9_qsv @ 0000021e8687df80] Low power mode is unsupported
[vp9_qsv @ 0000021e8687df80] Current frame rate is unsupported
[vp9_qsv @ 0000021e8687df80] Current picture structure is unsupported
[vp9_qsv @ 0000021e8687df80] Current resolution is unsupported
[vp9_qsv @ 0000021e8687df80] Current pixel format is unsupported
[vp9_qsv @ 0000021e8687df80] some encoding parameters are not supported by the QSV runtime. Please double check the input parameters.
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
Conversion failed!



So, how can we deal with VP9 + RTSP successfully ?