Fix sunrise output filename to reflect SUNRISE_TARGET_SECS from conf
The output video was always named -sunrise-10s.mp4 regardless of the configured duration. Both sunrise_video.10s.sh and sunrise2mm.py now derive the filename from SUNRISE_TARGET_SECS so changing it in conf produces correctly named files that the uploader still finds. https://claude.ai/code/session_01C4jbd3waXG3eKZYbGUjLUQ
This commit is contained in:
+2
-2
@@ -53,8 +53,8 @@ if not os.path.isdir(output_dir):
|
||||
print(f"Error: The directory {output_dir} does not exist. The video may not have been created yet.")
|
||||
exit(1)
|
||||
|
||||
# Find the sunrise video file for today (e.g., 2024-11-05-sunrise-10s.mp4)
|
||||
final_video_file = os.path.join(output_dir, f"{today_date_str}-sunrise-10s.mp4")
|
||||
target_secs = config.get('SUNRISE_TARGET_SECS', '10')
|
||||
final_video_file = os.path.join(output_dir, f"{today_date_str}-sunrise-{target_secs}s.mp4")
|
||||
|
||||
# Debugging: print the full path of the video file to make sure it's correct
|
||||
print(f"Looking for video file: {final_video_file}")
|
||||
|
||||
@@ -112,15 +112,14 @@ total_seconds=$(($hours * 3600 + $minutes * 60 + $seconds)) # Convert to total
|
||||
|
||||
target_duration=$SUNRISE_TARGET_SECS
|
||||
|
||||
# Calculate the speed-up factor to make the video fit into the target duration of 10 seconds
|
||||
speed_up_factor=$(echo "scale=3; $total_seconds / $target_duration" | bc)
|
||||
echo "Calculated speed-up factor: $speed_up_factor"
|
||||
|
||||
# Output filename for the second movie (speed-adjusted)
|
||||
final_video="$output_dir/$current_date-sunrise-10s.mp4"
|
||||
final_video="$output_dir/$current_date-sunrise-${SUNRISE_TARGET_SECS}s.mp4"
|
||||
|
||||
# Apply the speed adjustment using the setpts filter
|
||||
echo "Adjusting video speed to target duration of 10 seconds..."
|
||||
echo "Adjusting video speed to ${SUNRISE_TARGET_SECS}s..."
|
||||
ffmpeg -i "$first_movie" -filter:v "setpts=PTS/$speed_up_factor" -y "$final_video"
|
||||
|
||||
# Check the duration of the adjusted video
|
||||
|
||||
Reference in New Issue
Block a user