How to create a high quality video file from JPGs using FFMPEG?

Questions involving a Windows version of FFmpeg.
texdrone
Posts: 14
Joined: Sun Sep 15, 2019 10:39 pm

Re: How to create a high quality video file from JPGs using FFMPEG?

Post by texdrone » Sun Oct 27, 2019 7:57 pm

pandy wrote:
Sun Oct 27, 2019 7:34 pm
I think your ffmpeg is outdated - zscale is present in ffmpeg since quite long time - have no macos thus can't help but seem Zeranoe precompile binariers for 64 bit macos too. his builds should support zsale.

Anyway using rescale is not best idea (had this impression afterwhile) - perhaps better is to use pad.
I tried the last code you sent. This time it gave me the following error:

[Parsed_pad_0 @ 0x55fb80999cc0] Negative values are not acceptable.
[Parsed_pad_0 @ 0x55fb80999cc0] Failed to configure input pad on Parsed_pad_0
Error reinitializing filters!
Failed to inject frame into filter network: Invalid argument
Error while processing the decoded data for stream #0:0

pandy
Posts: 255
Joined: Mon Feb 24, 2014 1:46 pm

Re: How to create a high quality video file from JPGs using FFMPEG?

Post by pandy » Sun Oct 27, 2019 8:30 pm

Ok, i see... so seem there is no automatic way to not rescale and pad video so amount of lines is always MOD2 (dividable by 2 without fraction). Sorry then - seem you need to ad manually 1 line to match encoder expectations.

Code: Select all

@echo off
@setlocal

@set quality=12

@SET x264opts="crf=%quality%:level=4.0:qpmin=4:vbv_maxrate=30000:vbv_bufsize=20000:cabac=1:interlaced=0:no_psnr=1:no_ssim=1:bluray_compat=1:open-gop=0:pic_struct=1:aud=1:nal_hrd=vbr:force_cfr=1:fullrange=off:overscan=show:colorprim=bt709:transfer=bt709:colormatrix=bt709:stitchable=1"
@ffmpeg.exe -y -hide_banner -loglevel 32 -i "pic_ffv1.mkv" -vf pad=iw:ih+1,format=pix_fmts=yuv420p -c:v libx264 -preset medium -tune film -profile:v high -level:v 4.0 -x264opts %x264opts% -x264-params %x264opts% -movflags faststart -f mp4 "pic_h264.mp4"

texdrone
Posts: 14
Joined: Sun Sep 15, 2019 10:39 pm

Re: How to create a high quality video file from JPGs using FFMPEG?

Post by texdrone » Sun Oct 27, 2019 8:39 pm

pandy wrote:
Sun Oct 27, 2019 8:30 pm
Ok, i see... so seem there is no automatic way to not rescale and pad video so amount of lines is always MOD2 (dividable by 2 without fraction). Sorry then - seem you need to ad manually 1 line to match encoder expectations.
Ok, that cleared up the error... but now I get this one:

[libx264 @ 0x556772478a40] bad option '%x264opts%': '1'
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height

pandy
Posts: 255
Joined: Mon Feb 24, 2014 1:46 pm

Re: How to create a high quality video file from JPGs using FFMPEG?

Post by pandy » Mon Oct 28, 2019 6:08 pm

texdrone wrote:
Sun Oct 27, 2019 8:39 pm
[libx264 @ 0x556772478a40] bad option '%x264opts%': '1'
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
Script is tailored for Windows and as such all variables... not sure how to translate "DOS" batch for MacOS BSD alike script
https://stackoverflow.com/questions/140 ... -in-mac-os
https://superuser.com/questions/219191/ ... s-on-a-mac

texdrone
Posts: 14
Joined: Sun Sep 15, 2019 10:39 pm

Re: How to create a high quality video file from JPGs using FFMPEG?

Post by texdrone » Mon Oct 28, 2019 10:05 pm

pandy wrote:
Mon Oct 28, 2019 6:08 pm
Script is tailored for Windows and as such all variables... not sure how to translate "DOS" batch for MacOS BSD alike script
https://stackoverflow.com/questions/140 ... -in-mac-os
https://superuser.com/questions/219191/ ... s-on-a-mac
Ah! I looked up a few of the options that were giving me trouble and got it all working! Thanks again!!

I do have a follow up question. Since I know the original super 8mm film (which these images are scanned from) was shot at 18FPS... should I adjust the frame rate to 18FPS in the first step (lossless) or the 2nd step where I create the final output (mp4) file? Or does it matter?

pandy
Posts: 255
Joined: Mon Feb 24, 2014 1:46 pm

Re: How to create a high quality video file from JPGs using FFMPEG?

Post by pandy » Tue Oct 29, 2019 8:26 pm

There is no universal answer for your question related to framerate conversion - You can read about this (but not only) here https://www.thebattles.net/video/8mm_restoration.html - for sure i will do some test and at first shot try to not convert framerate at all - perhaps your player will be able to deal with 18 fps somehow without necessity to address this issue at the source level.

texdrone
Posts: 14
Joined: Sun Sep 15, 2019 10:39 pm

Re: How to create a high quality video file from JPGs using FFMPEG?

Post by texdrone » Tue Oct 29, 2019 10:26 pm

pandy wrote:
Tue Oct 29, 2019 8:26 pm
There is no universal answer for your question related to framerate conversion - You can read about this (but not only) here https://www.thebattles.net/video/8mm_restoration.html - for sure i will do some test and at first shot try to not convert framerate at all - perhaps your player will be able to deal with 18 fps somehow without necessity to address this issue at the source level.
Wow! I appreciate all of your help. Looks like I have some reading to do.

Thanks again!

Post Reply
'