This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 2 - Pages: 1 - Last Post: 23 Jan 26, 21:43 Last Post By: RobM
mabramsjalbum

Posts: 7
Registered: 24-Jul-2013
Fix video date for use in View By Date
Posted: 12 Jan 26, 08:30
 
  Click to reply to this thread Reply
I really like the new View by Date generated folder. I have a handful of videos that have the wrong date in some of the metadata. I tried a few online meta data editors, but wasn't able to update the date that JAlbum is using. Is there a way to fix the date used by JAlbum for a video file? The built in tool for metadata seems to only work for photos.

(I don't really care if the metadata in the actual file is really fixed; I'd just like to be able to fix these videos to be in the right folder year/month folder in the View by Date section).

Thanks.

Looking a the metadata using the JAlbum viewer

Mp4 sound.Creation Time=Thu Dec 31 16:00:00 -08:00 1903
Mp4 sound.Modification Time=Thu Dec 31 16:00:00 -08:00 1903
Mp4 video.Creation Time=Thu Dec 31 16:00:00 -08:00 1903
Mp4 video.Modification Time=Thu Dec 31 16:00:00 -08:00 1903
Mp4.Creation Time=Fri Dec 09 01:44:12 PST 2016
Mp4.Modification Time=Fri Dec 09 01:44:12 PST 2016
davidekholm

Posts: 3,917
Registered: 18-Oct-2002
Re: Fix video date for use in View By Date
Posted: 12 Jan 26, 12:38   in response to: mabramsjalbum in response to: mabramsjalbum
 
  Click to reply to this thread Reply
Try fixing the camera date with an external tool like ExifTool. jAlbum unfortunately doesn't support adjusting the camera date of videos.
RobM

Posts: 3,949
Registered: 4-Aug-2006
Re: Fix video date for use in View By Date
Posted: 23 Jan 26, 21:43   in response to: davidekholm in response to: davidekholm
 
  Click to reply to this thread Reply
davidekholm wrote:
Try fixing the camera date with an external tool like ExifTool. jAlbum unfortunately doesn't support adjusting the camera date of videos.
Here is some code that makes a copy of the selected video, without re-encoding, and changes the creation date (originalDate). The original is excluded and the copy has the same name but appended with '_updated'. Can be saved as an external tool or run from System console.
import java.lang.ProcessBuilder;
import se.datadosen.component.*;
import se.datadosen.util.*;
import se.datadosen.jalbum.*;
import se.datadosen.io.LinkFile;
 
String exampleDate = "2026-01-23T12:00:00"; // ISO 8601 format
msg ="Change original date for selected videos";
JTextField newDate = new JTextField(exampleDate, 10);
 
int answer = JOptionPane.showConfirmDialog(window, new Object[] {msg, newDate}, "<html>Enter new creation date<br>ISO 8601 format<br>YYYY-MM-DDThh:mm:ss</html>", JOptionPane.OK_CANCEL_OPTION);
if (answer != JOptionPane.OK_OPTION) return;
 
String setDate = newDate.getText();
VideoProcessor vp = engine.getVideoProcessor();
File exe = vp.getExecutable();
String ffmpeg = exe.toString().replaceAll(" ","\\ ");
 
AlbumObject[] cao = JAlbumContext.getInstance().getExplorer().explorer.getSelectedAlbumObjects();
String input = "";
String output = "";
 
//Loop through all of the selected videos
for (AlbumObject ao : cao) {
	input = ao.getFile().toString().replaceAll(" ","\\ ");
	output = (ao.getParent().getFile().toString() + "/" + ao.getName() + "_updated.mp4").replaceAll(" ","\\ ");
	ao.setIncluded(false);
 
	ProcessBuilder pb = new ProcessBuilder(ffmpeg, "-y", "-i", input, "-metadata", "creation_time=" + setDate, "-c", "copy", output);
	Process process = pb.start();
	int exitCode = process.waitFor();  
	if (exitCode == 0) {
  		System.out.println("Metadata updated successfully.");
	}
}
 
window.statusBar.setText("Script completed.");
Legend
Forum admins
Helpful Answer
Correct Answer

Point your RSS reader here for a feed of the latest messages in all forums