
Recherche avancée
Autres articles (54)
-
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 -
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 (...) -
Automated installation script of MediaSPIP
25 avril 2011, parTo overcome the difficulties mainly due to the installation of server side software dependencies, an "all-in-one" installation script written in bash was created to facilitate this step on a server with a compatible Linux distribution.
You must have access to your server via SSH and a root account to use it, which will install the dependencies. Contact your provider if you do not have that.
The documentation of the use of this installation script is available here.
The code of this (...)
Sur d’autres sites (10397)
-
Why Yuv data readed from ffmpeg is different from original input yuv ?
13 mai 2021, par sianyi HuangI use ffmpeg to make HDR test video, my approach is write a image, converting the image to yuv420p and then use ffmpeg to make the HDR test video.



But I found the yuv data readed from mp4 is different from the original input..
I was stucked in here for a while, does anyone know how to read the correct yuv data from mp4 ?



#ffmpeg encode command
ffmpeg_encode_mp4 = \
"ffmpeg -y -s 100*100 -pix_fmt yuv420p -threads 4 -r 1 -stream_loop -1 -f rawvideo -i write_yuv.yuv -vf \
scale=out_h_chr_pos=0:out_v_chr_pos=0,format=yuv420p10le \
-c:v libx265 -tag:v hvc1 -t 10 -pix_fmt yuv420p10le -preset medium -x265-params \
crf=12:colorprim=bt2020:transfer=smpte2084:colormatrix=bt2020nc:master-display=\"G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)L(10000000,1)\":max-cll=\"1000,400\" \
-an test.mp4"

#ffmpeg read yuv from mp4 command
ffmpeg_extract_yuv = "ffmpeg -i test.mp4 -vframes 1 -c:v rawvideo -pix_fmt yuv420p read_yuv.yuv"


#make 100*100 yuv raw
w, h = 100, 100
test_gray = 255
test = np.full((100, 100, 3), test_gray, dtype=np.uint8)
yuv_cv = cv.cvtColor(test, cv.COLOR_RGB2YUV_I420)
yuv_cv.tofile("write_yuv.yuv")

#encode yuv raw to mp4 with HDR metadata
print(ffmpeg_encode_mp4)
result = subprocess.check_output(ffmpeg_encode_mp4, shell = True)
print(result)
sleep(0.5)

#extract yuv from mp4
kill_existing_file("read_yuv.yuv")
print(ffmpeg_extract_yuv)
result = subprocess.check_output(ffmpeg_extract_yuv, shell = True)
print(result)
sleep(0.5)

write_yuv = np.fromfile("write_yuv.yuv",dtype='uint8')
read_yuv = np.fromfile("read_yuv.yuv",dtype='uint8')

print("input gray:", test_gray)
print("write_yuv", write_yuv[:10])
print("read_yuv", read_yuv[:10])

reader = imageio.get_reader("test.mp4")
img = reader.get_data(0)
print("imgeio read:", img[50, 50])

'''
ouput result:
input gray: 255
write_yuv [235 235 235 235 235 235 235 235 235 235]
read_yuv [234 235 234 235 234 235 234 235 234 235]
imgeio read: [253 253 253]
'''




I have no idea how to validate the video I made is corret
Any feedback will be very appreciated !


-
Java does not run command in Linux
9 août 2017, par ArianaI have problems executing this
ffmpeg
command in my java code :ffmpeg -i sample.mp4 -i ad.mp4 -filter_complex "[0:v]trim=0:15,setpts=PTS-STARTPTS[v0]; [1:v]trim=0:5,setpts=PTS-STARTPTS[v1]; [0:v]trim=20:30,setpts=PTS-STARTPTS[v2]; [v0][v1][v2]concat=n=3:v=1:a=0[out]" -map "[out]" output.mp4
I use this command :
String command= "ffmpeg -i "+dir+"sample.mp4 -i "+dir+"ad.mp4 -filter_complex [0:v]trim=0:15,setpts=PTS-STARTPTS[v0]; [1:v]trim=0:5,setpts=PTS-STARTPTS[v1]; [0:v]trim=20:30,setpts=PTS-STARTPTS[v2]; [v0][v1][v2]concat=n=3:v=1:a=0[out] -map [out] output.mp4";
final ProcessBuilder pb = new ProcessBuilder("/bin/sh", "-c", command);
System.out.println(command);
final Process p = pb.start();I simply remove the
"
. But still no chance.I also used the
getRuntime()
method, but that also doesn’t work for me.String c1=" -i "+dir+"sample.mp4 "+"-i "+dir+"ad.mp4 -filter_complex [0:v]trim=0:15,setpts=PTS-STARTPTS[v0]; [1:v]trim=0:5,setpts=PTS-STARTPTS[v1]; [0:v]trim=20:30,setpts=PTS-STARTPTS[v2]; [v0][v1][v2]concat=n=3:v=1:a=0[out] -map [out] "+dir+"output.mp4";
RunCommand("ffmpeg"+c1);Using this method :
private static void RunCommand(String command) throws InterruptedException {
try {
// Execute command
Process proc = Runtime.getRuntime().exec(command);
System.out.println(proc.exitValue());
// Get output stream to write from it
// Read the output
BufferedReader reader =
new BufferedReader(new InputStreamReader(proc.getInputStream()));
String line = "";
while((line = reader.readLine()) != null) {
System.out.print(line + "\n");
// System.out.println(ads.get(0));
}
proc.waitFor();
} catch (IOException e) {
}
}This one doesn’t work also, and printing the exit value shows this :
Exception in thread "main" java.lang.IllegalThreadStateException: process hasn't exited
at java.lang.UNIXProcess.exitValue(UNIXProcess.java:423)
at parser.Parser.RunCommand(Parser.java:106)
at parser.Parser.commandGenerator2(Parser.java:79)
at parser.Parser.main(Parser.java:44)If I move the
proc.waitFor();
before printing the exit value, it is1
.What is the problem ? Why it doesn’t run in Java code ?
-
Setting UseShellExecute = false doesn't work in Process.Start
5 décembre 2015, par Alex JoligThere’s a good Q&A about hiding shell execute when running a process which led me to write my own code using ffmpeg :
Process proc = new Process();
proc.StartInfo.FileName = "ffmpeg";
proc.StartInfo.Arguments = string.Format("-ss {0} -i \"{1}\" -t {2}{3} DB\\Media\\{4}{5} -y",
TimeSpan.Parse(row.Cells["StartdgvList"].Value.ToString()),
openFileDialog.FileName, _durationTime, quality, newTmpSound,
GetExtension(openFileDialog.FileName));
proc.StartInfo.RedirectStandardError = true;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.CreateNoWindow = true;
if (!proc.Start()) return;
StreamReader reader = proc.StandardError;
string line;
while ((line = reader.ReadLine()) != null && !_cancel)
{
//Doing something with process line
}
proc.Close();This works fine, But when I run it in a few user machines, it just stops working with no error.
I tried removing lines which hides shell window and turned it to this :
Process proc = new Process();
proc.StartInfo.FileName = "ffmpeg";
proc.StartInfo.Arguments = string.Format("-ss {0} -i \"{1}\" -t {2}{3} DB\\Media\\{4}{5} -y",
TimeSpan.Parse(row.Cells["StartdgvList"].Value.ToString()),
openFileDialog.FileName, _durationTime, quality, newTmpSound,
GetExtension(openFileDialog.FileName));
if (!proc.Start()) return;
proc.Close();and it start working in all the machines.
I’m wondering if there’s some sort of service or components missing in some machines which makes the process fails when console is hiding.
I appreciate if anyone has any idea.
P.S : I installed
Visual Studio 2012
on a machine which has problem hiding shell window and it suddenly start working. MaybeVS2012
installed somwthing on the machine which solved the problem.