mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-30 23:19:49 +00:00
Minor code improvements
This commit is contained in:
parent
3a7d3410d3
commit
1088a8bbe7
|
@ -547,6 +547,7 @@ func export_video(export_paths: PackedStringArray, project: Project) -> bool:
|
|||
if layer.audio.get_length() >= max_audio_duration:
|
||||
max_audio_duration = layer.audio.get_length()
|
||||
if audio_layer_count > 0:
|
||||
# If we have audio layers, merge them all into one file.
|
||||
var amix_inputs_string := "amix=inputs=%s" % audio_layer_count
|
||||
var audio_file_path := temp_path_real.path_join("audio.mp3")
|
||||
ffmpeg_combine_audio.append_array(
|
||||
|
@ -554,6 +555,8 @@ func export_video(export_paths: PackedStringArray, project: Project) -> bool:
|
|||
)
|
||||
OS.execute(Global.ffmpeg_path, ffmpeg_combine_audio, [], true)
|
||||
var copied_video := temp_path_real.path_join("video." + export_paths[0].get_extension())
|
||||
|
||||
# Then mix the audio file with the video.
|
||||
DirAccess.copy_absolute(export_paths[0], copied_video)
|
||||
# ffmpeg -y -i video_file -i input_audio -c:v copy -map 0:v:0 -map 1:a:0 video_file
|
||||
var ffmpeg_final_video: PackedStringArray = [
|
||||
|
|
|
@ -91,8 +91,8 @@ func _play_audio() -> void:
|
|||
var audio_length := audio_player.stream.get_length()
|
||||
var final_frame := audio_length * Global.current_project.fps
|
||||
if Global.current_project.current_frame < final_frame:
|
||||
var inverse_fps := 1.0 / Global.current_project.fps
|
||||
var playback_position := Global.current_project.current_frame * inverse_fps
|
||||
var seconds_per_frame := 1.0 / Global.current_project.fps
|
||||
var playback_position := Global.current_project.current_frame * seconds_per_frame
|
||||
audio_player.play(playback_position)
|
||||
else:
|
||||
audio_player.stop()
|
||||
|
|
Loading…
Reference in a new issue