VideoHelp Forum




+ Reply to Thread
Results 1 to 9 of 9
  1. Hello everybody

    Is there anybody who may help me with an advice regarding creation of a video file from a mp3 file and a still image to be uploaded on youtube ?
    I have used Movavi, but the video file I obtained is way too big to be uploaded on youtube...! The source mp3 file is 138 MB and the pictrure I used is 88 kb....
    I tried several formats for the output file, and the smallest I obtained was 1.2 GB....way too big to be uploaded on youtube....!
    Maybe somebody can point out any other software to be used...! I don't care what software I will be using....! I just want to obtain a video file under 200 MB...!
    Quote Quote  
  2. At first you can read this: https://trac.ffmpeg.org/wiki/Slideshow

    Code:
    @setlocal
    
    @set vproc="scale='if(gt(a,16/9),1820,-16)':'if(gt(a,16/9),-16,1024)':sws_flags=spline+accurate_rnd+full_chroma_int+full_chroma_inp,pad=1920:1080:(ow-iw)/2:(oh-ih)/2,format=pix_fmts=yuv420p"
    
    @SET x264opts="crf=24:level=4.0:qpmin=8:cabac=1:no_psnr=1:no_ssim=1:fullrange=on:overscan=show:colorprim=bt709:transfer=bt709:colormatrix=bt709"
    
    @ffmpeg.exe -hide_banner -v quiet -stats -y -color_range 2 -loop 1 -i "image.jpg" -i "audio.mp3" -map 0 -vf %vproc% -c:v libx264 -preset faster -tune stillimage -profile:v high -level:v 4.0 -x264opts %x264opts% -x264-params %x264opts% -color_range 2 -map 1:a? -c:a copy -sn -dn -shortest -movflags faststart -f mp4 "audio_image.mp4"
    
    @endlocal
    @pause
    Above example should work - video bitrate was around 150kbps, by cahnging crf (24 in my example) you can change video bitrate (rule is simple higher than 24 will reduce bitrate but also affect quality, lower increase bitrate and quality - IMHO 24 is good compromise).
    Quote Quote  
  3. No problem, after few tests this is improved (IMHO) script - should be faster - perhaps YT will accept low framerate video - you can do some tests and provide feedback - framerate is configured by changing
    Code:
    @set vproc="fps=fps=24/12
    to something else - currently it is 2 fps (24/12) - in my case script was 20 times faster.

    Code:
    @setlocal
    
    @set image=%1
    @set audio=%2
    @set vq=40
    
    @set vproc="fps=fps=24/12,scale='if(gt(a,16/9),1878,-16)':'if(gt(a,16/9),-16,1056)':sws_flags=spline+accurate_rnd+full_chroma_int+full_chroma_inp:out_color_matrix=bt709,pad=1920:1080:(ow-iw)/2:(oh-ih)/2:color=black,format=pix_fmts=yuv420p"
    @SET x264opts="crf=%vq%:level=4.0:qpmin=8:cabac=1:no_psnr=1:no_ssim=1:fullrange=on:overscan=show:colorprim=bt709:transfer=bt709:colormatrix=bt709"
    
    @ffmpeg.exe -hide_banner -v quiet -stats -y -color_range 2 -loop 1 -r 1 -i "%image%" -i "%audio%" -vf %vproc% -c:v libx264 -preset faster -tune stillimage -profile:v high -level:v 4.0 -x264opts %x264opts% -x264-params %x264opts% -color_range 2 -c:a copy -sn -dn -shortest -movflags faststart -f mp4 "%~n2_%~n1.mp4"
    
    @endlocal
    @pause
    forget to mention that script expect two names (with extensions) as parameters - first parameter is image and second audio, using system variables as ffmpeg doesn't like spaces and other complicated names - not sure why so this dirty hack seem to work fine.
    Quote Quote  
  4. Member Bernix's Avatar
    Join Date
    Apr 2016
    Location
    Europe
    Search Comp PM
    Hi,
    other way to do it is in any non linear editing (NLE) editor. You can do transition between pictures and much more. But Pandy's ffmpeg script is of course excellent!

    Edit: I don't think, there will be big difference in size between 2fps and 25fps, if the picture is still same. Maybe of course faster encoding, but isn't better to keep standard fps?
    O.K. 2fps encode video faster, and is smaller. It should work in youtube. Altough at 25fps 1min video has cca 500 kB.

    Bernix
    Last edited by Bernix; 12th Nov 2017 at 08:39. Reason: EDIT
    Quote Quote  
  5. Originally Posted by Bernix;2501625
    [/B
    Edit: I don't think, there will be big difference in size between 2fps and 25fps, if the picture is still same. Maybe of course faster encoding, but isn't better to keep standard fps?
    O.K. 2fps encode video faster, and is smaller. It should work in youtube. Altough at 25fps 1min video has cca 500 kB.
    i've done some test and it looks like average bitrate for low fps video is around 4kbps - if it works for YT upload then it is OK IMHO - side - curious why YT will not offer special encoding case where picture and audio files can be combined at YT side... should reduce YT infrastructure load.
    Quote Quote  
  6. Member Bernix's Avatar
    Join Date
    Apr 2016
    Location
    Europe
    Search Comp PM
    Hi Pandy,
    the main difference is of course in keyframe interval. In 25fps it is 6 times per minute, in your case 12,5 less. So you was right as usual. I tested it on 842x596 and in 2 fps it was 9600 b/s.
    But at same amount of frame (1506) 2fps is is bigger about 50% it means 861kB vs 590kB not sure why.

    Bernix
    Last edited by Bernix; 12th Nov 2017 at 16:47. Reason: Amount of frames different size same settings
    Quote Quote  
  7. You could leave frame rate as it is but change keyint variable to infinite, that makes only one GOP for the whole video and there is one image only for the whole video, so you can get lower CRF to get quality of that picture higher. Video size is in that case almost none, except first I frame, then it is negligible, almost audio bitrate only.
    I tried to upload videos encoded like that years back and YouTube accepted it.
    https://forum.videohelp.com/threads/361166-Best-Sony-Vegas-Format-For-a-Still-w-Audio#post2290685
    Quote Quote  
  8. Indeed _Al_ is right - seem this trick works fine and if YT accept such video then seem to be best option possible.

    Code:
    @setlocal
    
    @set image=%1
    @set audio=%2
    @set vq=16
    
    @set vproc="fps=fps=24/24,scale='if(gt(a,16/9),1878,-16)':'if(gt(a,16/9),-16,1056)':sws_flags=spline+accurate_rnd+full_chroma_int+full_chroma_inp:out_color_matrix=bt709,pad=1920:1080:(ow-iw)/2:(oh-ih)/2:color=black,format=pix_fmts=yuv420p"
    
    @SET x264opts="crf=%vq%:level=4.1:qpmin=8:cabac=1:keyint=infinite:no-deblock=1:no-mbtree=1:me=dia:rc-lookahead=5:ref=3:subme=0:no-weightb=1:weightp=0:trellis=0:no-scenecut=1:no_psnr=1:no_ssim=1:fullrange=on:overscan=show:colorprim=bt709:transfer=bt709:colormatrix=bt709"
    
    @ffmpeg.exe -hide_banner -v 32 -stats -y -color_range 2 -loop 1 -r 1 -i "%image%" -i "%audio%" -vf %vproc% -c:v libx264 -preset faster -tune stillimage -profile:v high -level:v 4.1 -x264opts %x264opts% -x264-params %x264opts% -color_range 2 -c:a copy -sn -dn -shortest -movflags faststart -f mp4 "%~n2_%~n1.mp4"
    
    @endlocal
    @pause
    This one is way faster - disabled some options related to motion analysis.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!