I am stuck on my code.
This is my command of ffmpeg
through which I am pasting texts on particular video.
Code in Java:
try {
char double_quote = '\"';
String devajuserif_font = "DejaVuSerif.ttf";
Date date1 = new Date(Long.parseLong(date));
SimpleDateFormat df2 = new SimpleDateFormat("dd/MM/yy");
date = df2.format(date1);
String videoEditingCommand = "ffmpeg -i " + file.getAbsolutePath() + " -vf " + double_quote
+ "[in]drawtext=fontsize=10:fontcolor=Red:fontfile=" + devajuserif_font + ":text=Latitude-'" + latitude
+ "':x=0:y=0, drawtext=fontsize=10:fontcolor=Red:fontfile=" + devajuserif_font + ":text=Longitude-'"
+ longitude + "':x=0:y=10, drawtext=fontsize=10:fontcolor=Red:fontfile=" + devajuserif_font
+ ":text=Accuracy-'" + accuracy + " m':x=0:y=20, drawtext=fontsize=10:fontcolor=Red:fontfile="
+ devajuserif_font + ":text=Date-'" + date + "':x=0:y=30[out]" + double_quote + " -y "
+ file.getAbsolutePath();
ProcessBuilder builder = new ProcessBuilder("cmd.exe", "/c", videoEditingCommand); //for windows
builder.redirectErrorStream(true);
Process p = builder.start();
BufferedReader r = new BufferedReader(new
InputStreamReader(p.getInputStream()));
String line;
while (true) {
line = r.readLine();
if (line == null) {
break;
}
log.info(line);
}
}
My video length is 1 minute. But after conversion, When I download video after pasting text on video, It's length reduces to 1 second. It is getting error. says:
Invalid NAL unit size (755 > 249). D:\test\upload21-3Aug2017061732GMT_1501741052377.mp4: Invalid data found when processing input
Can someone help me?