HypoX64 / DeepMosaics

Automatically remove the mosaics in images and videos, or add mosaics to them.
GNU General Public License v3.0
2.08k stars 435 forks source link

Is it possible to set the bitray #82

Open bwrw88 opened 2 years ago

bwrw88 commented 2 years ago

Can you make it come out in the same size as the original video?

Lukas-52 commented 2 years ago

DeepMosaics seems to be using CRF for output conversion, unfortunately it seems nobody wants to share the secret of how to change is, since this question, or others very similar have been asked before but never answered. Whatever CRF is used by default, it's not good enough in my opinion. There is a noticeable loss of detail in areas that aren't getting processed...

d0ne187 commented 2 years ago

When you run the master code directly you can edit the util/ffmpeg.py file. Just edit the line below "image2video". Mine currently looks like this while using the png option: os.system('ffmpeg -y -r '+str(fps)+' -i '+imagepath+' -vcodec libx264 -crf 20 -tune film -preset slow -pix_fmt yuv420p -vf colormatrix=bt601:bt709 -sws_flags +accurate_rnd+full_chroma_int '+os.path.split(voicepath)[0]+'/video_tmp.mp4')

Lukas-52 commented 2 years ago

And if i am using the prebuild exe Version provided under the releases tab?

I haven't found anything hinting towards ffmpeg settings in there.

d0ne187 commented 2 years ago

I don't know if and how you could change the built version. But if you install Python and the prerequisites you just have to execute one command line. I would just recommend to install pytorch using the instructions on their site with the correct Cuda version. On my first install the code didn't use my graphics card. But maybe I just had the wrong Cuda version.

Lukas-52 commented 2 years ago

Maybe it would be good feature to make it possible to pass the video setting to ffmpeg using the advanced options in the Precompiled version. If you have never worked with python its a royal pain to get it running. Especially under windows.

Milincho commented 2 years ago

And if i am using the prebuild exe Version provided under the releases tab?

I haven't found anything hinting towards ffmpeg settings in there.

What I do to get maximum quality is using the temp png file sequence. To avoid DeepMosaics automatically deleting the png temp sequence just create a [your video name]_clean.mp4 in DeepMosaics\result\ , and then DeepMosaics will stop before creating the final video file and deleting the top quality png sequence, asking for your confirmation: File '../result/[your video name]_clean.mp4' already exists. Overwrite? [y/N]

Now you can copy/move the png sequence from DeepMosaics\core\tmp\DeepMosaics_temp\replace_mosaic\ to other safe path, before DeepMosaics delete it.

Then you can use NmKoder, Premiere or whatever to make the final video with your chosen settings.