Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle non-aligned timestamps #69

Open
grusell opened this issue Dec 14, 2024 · 1 comment
Open

Handle non-aligned timestamps #69

grusell opened this issue Dec 14, 2024 · 1 comment

Comments

@grusell
Copy link
Collaborator

grusell commented Dec 14, 2024

Cases where the (start) timestamps of two files are not aligned should be handled better. Possible default strategies could be:

1 Automatically set frameoffset so that the starting frames of both videos align
2 Fast forward to the first timestamp that are present in both files
3 Combination of the above, ie use strategy 2 if possible, otherwise 1

See also #67

@Gloster10
Copy link

I use a workaround :
The start timestamps of two ts-files (or other) will be set to = 0, and a new container "mp4" will be used. To minimize the conversion time, only the first 10 min. will be converted, after all, vivictpp will be started with new generated files.

Only two files are in the directory.

The script :
`#!/bin/bash

declare -a new_videos

while IFS= read -r -d $'\0' video
do
filename=$(basename -- "$video")
filename="${filename%.*}"

#ffmpeg grep, s.: https://stackoverflow.com/questions/16931244/checking-if-output-of-a-command-contains-a-certain-string-in-a-shell-script
if ffmpeg -i "$video" null - 2>&1 | grep -q "hevc";
#if ffmpeg -i "$video" null - 2>&1 | grep -q "h264";
then
ffmpeg -y -i "$video" -codec copy -muxpreload 0 -muxdelay 0 -t 00:10:00.000 "${filename}0.mp4" </dev/null
new_video="${filename}0.mp4"
new_videos+=("$new_video")
else
ffmpeg -y -i "$video" -codec copy -muxpreload 0 -muxdelay 0 -t 00:10:00.000 "${filename}O0.mp4" </dev/null
new_video="${filename}O0.mp4"
new_videos+=("$new_video")
fi

done < <(find -iregex ".*.(m2ts|webm|ts|mp4|mkv)" -print0)

vivictpp "${new_videos[0]}" "${new_videos[1]}" `

To leave the videos in a ts-container, did lead to a timestamp offset difference of 40-80ms after conversion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants