https://github.com/esausilva/process-videos-synology
Transcode HVEC to H.264 video files for Synology Photos and fix timestamps
https://github.com/esausilva/process-videos-synology
dsm synology synology-nas synology-photos
Last synced: 4 months ago
JSON representation
Transcode HVEC to H.264 video files for Synology Photos and fix timestamps
- Host: GitHub
- URL: https://github.com/esausilva/process-videos-synology
- Owner: esausilva
- Created: 2023-03-13T23:49:59.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-06-10T22:48:14.000Z (about 1 year ago)
- Last Synced: 2024-12-30T20:28:48.816Z (6 months ago)
- Topics: dsm, synology, synology-nas, synology-photos
- Language: Shell
- Homepage: https://esausilva.com/2023/03/15/fix-synology-photos-not-playing-hvec-videos-not-reading-created-timestamp/
- Size: 2.93 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Process Video Files For Synology Photos
The script takes in a path as the first argument where the video files that need processing are saved. Make sure to enclose the path with quotation marks.
```
./script.sh "/path/to/directory"
```Before running the script, you might need to assign executable permissions `chmod +x script.sh`.
The script changes the default IFS to a new line (`\n`) character, then at the end it restores the original IFS. This is because inside a `for` loop, if the directory path has spaces, the terminal will split the path string into multiple lines, thus, creating an invalid path. By changing the IFS to a new line character, the splitting will happen at the end of the string.
The first step is to get the original taken timestamp which is in UTC, then convert this timestamp into Central Time.
After we have the timestamp in Central Time, copy into the "created" and "modified" metadata using the [exiftool](https://exiftool.org/) tool.
The second step is to transcode video files taken with HVEC (H.265) encoding to H.264 since Synology Photos cannot play or index videos encoded with HVEC. For this step, the script uses [ffmpeg](https://ffmpeg.org/) tool.
The transcoded video file will have the same name as the original file, but with `_out` string appended at the end and it will be created in the same directory as the original video file.
### Note Related to Converting UTC Timestamp to CT
Change `-05:00` to your timezone at the end of the below conversion.
```
trackCreateDateInCentralTimeZone=$(date -jf "%Y:%m:%d %H:%M:%S %z" "$trackCreateDate +0000" +"%Y:%m:%d %H:%M:%S-05:00")
```## Giving Back
If you find this repo useful in any way, consider getting me a coffee by clicking on the image below. I would really appreciate it!
[](https://www.buymeacoffee.com/esausilva)
-Esau