MartinBarker / RenderTune

RenderTune is a free electron app for Mac/Windows/Linux that uses ffmpeg to combine audio.+image file(s) into video files. Discord: https://discord.gg/GxfJv5sB
https://www.martinbarker.me/RenderTune
MIT License
28 stars 7 forks source link

[Request] Add an option to use source audio files when rendering, rather than converting to mp3 first. #13

Closed Tenome closed 2 years ago

Tenome commented 2 years ago

ffmpeg can support rendering flacs, etc. just fine. The program seems to convert the audio to mp3 during concatenation first, but I don't want to do that since Youtube already transcodes the audio when you upload something.

MartinBarker commented 2 years ago

Good idea, I can see how changes to rendertune could be made to shorten the amount of ffmpeg conversions so that quality is maintained. I would also like to add an option for advanced users to view the ffmpeg commands used more easily. Since rendertune is basically running ffmpeg commands on a bash shell.

Here are some different rendertune use cases and ways which I think they could be improved like you describe:

If a user tries to combine 1 mp3 file with 1 image file, rendertune should be able to combine them with one command.

If a user tries to combine multiple mp3 files with 1 image file, rendertune currently creates a single concatenated mp3 file which it renders into a video. There might be a more efficient ffmpeg command to do this. Likewise if a user wants to combine multiple flac or other files all of the same format into a video, there might be a smart ffmpeg command that combines them with the image file into a video all in one line without creating the concatenated mp3.

I think what you are suggesting is to improve efficiency and remove any unnecessary conversions into concatenated mp3 files, correct? So that audio quality does not suffer from multiple ffmpeg audio concatenation commands.

Tenome commented 2 years ago

Correct. ffmpeg does support concating without conversion I think, but it's kind of a pain since you have to read a list of filenames. Looking at newindex.js, I think if you just rename the ".mp3" to .flac, it'll leave it as-is right? I dunno how to compile Javascript so I can't test it myself.

      `concatAudioFilepath: `${outputDir}${path.sep}output-${(Date.now().toString()).substring(7)}.mp3`,`
MartinBarker commented 2 years ago

That line is just the output filepath location, we would probably have to change the ffmpeg command being constructed. RenderTune does have built in debug dev tools, with the program open, enter the key bind combination: "Ctrl + Shift + i" which should open the dev tools on the right side of the program (or try right click => inspect element)

If you render a vid, it will output the ffmpeg command used in array format cmdArr= for concating audio and/or rendering video. check it out

image

Tenome commented 2 years ago

I believe ffmpeg can automatically choose the correct codec based on the filename, so replacing it with .flac should work I think.

For reference, this is the cmd batch script I use when making making individual videos for each song.

for /R %%a IN (*.wav *.flac *.mp3) DO C:\ffmpeg\bin\ffmpeg.exe -loop 1 -i cover.jpg -i "%%~a" -c:v libx264 -c:a copy -shortest "%%~na.mkv"

Oh I see you put some arguments for 320k mp3, yeah that stuff would have to be removed for the flac/wav option.

MartinBarker commented 2 years ago

I tested changing the end of the concat audio filename to .flac and rendered a vid using mp3/flac files combined but it resulted in an error. I'll test the command you posted and try changing up the ffmpeg commands used in rendertune, will post my updates here

Tenome commented 2 years ago

It shouldn't be that hard, I imagine. You probably just have to edit this line to remove the arguments for MP3 encoding at the end and replace it with -c:v libx264 -c:a copy -shortest

"-filter_complex", "[0:a][1:a][2:a][3:a][4:a][5:a][6:a][7:a][8:a][9:a][10:a][11:a][12:a][13:a]concat=n=14:v=0:a=1[a]", "-map", "[a]", "-c:a", "libmp3lame", "-b:a", "320k",

MartinBarker commented 2 years ago

I've re-done the ffmpeg commands to concatenate audio and render video in a single command, with higher quality for mp4 videos and support for .mkv video output which preserves the original audio quality. working on getting this added to the next release ( v1.2.0 )

Tenome commented 2 years ago

Looking forward to it!

MartinBarker commented 2 years ago

Sorry for how long it's been taking, I keep adding quality of life fixes and small improvements, I'm going to finalize the v1.2.0 this weekend, and submit the new build for review before the end of the month.

MartinBarker commented 2 years ago

Just released v1.1.1, on apple store, linux snap store, windows store review still in process. new files in version on this github.

Features include .mkv options, better ffmpeg commands, see all changes on release page:

https://github.com/MartinBarker/RenderTune/releases/tag/v1.1.1

Tenome commented 2 years ago

Thanks!