Cerrado

FFMPEG is timing out and getting killed before completing process

Este proyecto recibió 12 ofertas de freelancers talentosos con una oferta promedio de $118 USD.

Obtén cotizaciones gratis para un proyecto como este
Empleador trabajando
Presupuesto de Proyecto
$10 - $100 USD
Ofertas Totales
12
Descripción del Proyecto

I have a script that takes an mp4 file and splits it into another mp4 file. It basically takes a section like 00:22:38 to 00:23:16 and creates a new video from that time segment.

The problem is that for larger files the process stops and gets killed before finishing.

ffmpeg -i "/uploads/files/[url removed, login to view]" -ss 00:22:38 -t 00:23:16 -async 1 "/uploads/files/[url removed, login to view]"

problem is [url removed, login to view]() does not wait and the process is killed without any errors in the log file.

the process actually starts but killed before completion.

This is the script that is called.

@RequestMapping(value = "/videotrim", method = [url removed, login to view])

public void trimVideo(@RequestParam Long id, @RequestParam("start-time") Integer startTime, @RequestParam("end-time") Integer endTime) {

[url removed, login to view](getClass().getName()).log([url removed, login to view], "called");

Document one = [url removed, login to view](id);

[url removed, login to view](getClass().getName()).log([url removed, login to view], "called" + [url removed, login to view]);

String inputFile = [url removed, login to view]("%20"," ");

final String movieFile = "/uploads" + inputFile;

final String resultFile = "/uploads/files/" + id + "-" + startTime + "-" + endTime + ".mp4";

//ffmpeg -i [url removed, login to view] -ss 00:00:03 -t 00:00:08 -async 1 [url removed, login to view]

Time start = new Time(startTime * 1000);

Time end = new Time(endTime * 1000);

final String startTimeSec = [url removed, login to view]();

final String endTimeSec = [url removed, login to view]();

Runnable runnable = new Runnable() {

public void run() {

try {

File file = new File(resultFile);

if (![url removed, login to view]()) {

final String command = "ffmpeg -i \"" + movieFile + "\" -ss " + startTimeSec + " -t " + endTimeSec + " -async 1 \"" + resultFile + "\"";

[url removed, login to view](getClass().getName()).log([url removed, login to view], "running: " + command);

ProcessBuilder pb = new ProcessBuilder("ffmpeg", "-i", movieFile, "-ss", startTimeSec, "-t", endTimeSec, "-async", "1", resultFile);

pb = [url removed, login to view](true); // equivalent of 2>&1

Process p = [url removed, login to view]();

[url removed, login to view]();

file = new File(resultFile);

[url removed, login to view](true,false);

} else {

[url removed, login to view](true,false);

}

} catch (Throwable e) {

[url removed, login to view](getClass().getName()).log([url removed, login to view], "error while trim video", e);

[url removed, login to view]();

}

}

};

new Thread(runnable).start();

}

Buscando hacer algo de dinero?

  • Establece tu presupuesto y período de tiempo
  • Describe tu propuesta
  • Consigue pago por tu trabajo

Contrata Freelancers que también oferten en este proyecto

    • Forbes
    • The New York Times
    • Time
    • Wall Street Journal
    • Times Online