VideoHelp Forum




+ Reply to Thread
Results 1 to 11 of 11
  1. Member
    Join Date
    Mar 2011
    Location
    Paris, France
    Search PM
    Hello,

    I can't figure out why the following command doesn't scale the video down from 1200 pixels to 640 pixels as expected:

    Code:
    ffmpeg.exe -i input.mov -preset faster -t 15 -c:v libx264 -vf scale=-640:-1,lutyuv=y=val*1.30,format=pix_fmts=yuv420p -c:a aac -b:a 128k -ac 2 -ar 44100 -af "volume=0.3" -threads 2 -f mp4 output.mp4
    What am I doing wrong?

    Thank you.

    ---
    Edit: In case I'd like to speed up the video by 50%, how should I add the setting below?

    "setpts=0.5*PTS"
    Last edited by yetanotherlogin; 26th Aug 2017 at 05:54.
    Quote Quote  
  2. Originally Posted by yetanotherlogin View Post
    -vf scale=-640:-1
    typo ?

    did you try 640 instead of -640 ?
    Quote Quote  
  3. Member
    Join Date
    Mar 2011
    Location
    Paris, France
    Search PM
    Yes, indeed, a typo

    What about speeding it up? How should I insert "setpts=0.5*PTS" into the vf option?
    Quote Quote  
  4. Like you separated the other filters: with a comma.

    ( 50% speedup would be *0.75, I think.)
    Quote Quote  
  5. Member
    Join Date
    Mar 2011
    Location
    Paris, France
    Search PM
    Thank you.

    --
    Edit: Appartently, speeding up a video isn't as simple as adding "setpts=0.5*PTS" to the "-vf" switch: The video stops halfway through while the audio keeps going

    --
    Edit: This doesn't work. The video is neither scaled down to 720:whatever nor sped up"

    Code:
    ffmpeg -i input.mp4 -filter_complex "scale=720:404;[0:v]setpts=0.5*PTS[v];[0:a]atempo=2.0[a]" -map "[v]" -map "[a]" -c:a aac -b:a 128k -ac 2 -ar 44100 -threads 2 -f mp4 output.mp4
    Looks like you can't add a "scale" switch to a "filter_complex" command.
    Last edited by yetanotherlogin; 25th Aug 2017 at 15:53.
    Quote Quote  
  6. Member
    Join Date
    Mar 2011
    Location
    Paris, France
    Search PM
    The work-around is to run the command twice:

    Code:
    ffmpeg -i input.mp4 -filter_complex "[0:v]setpts=0.5*PTS[v];[0:a]atempo=2.0[a]" -map "[v]" -map "[a]" -f mp4 output.sped.up.mp4
    
    ffmpeg -i output.sped.up.mp4 -vf "scale=720:404" -crf 18 -f mp4 output.sped.up.resized.mp4
    Quote Quote  
  7. Of course you can add scale... bellow is example (without PTS manipulation but this should not be a problem).

    Code:
    -vf "eq=contrast=256/220:brightness=1/512:saturation=256/224:gamma=16/16,scale=640:-4:sws_flags=spline+accurate_rnd+full_chroma_int+full_chroma_inp:sws_dither=0:in_range=1:out_range=1,hqdn3d=8,tblend=all_mode=average,smartblur=lr=1.75:ls=-0.50:lt=-5.5:cr=0.5:cs=1.0:ct=0.5,minterpolate=fps=25:mi_mode=mci:me_mode=bidir:me=ntss:vsbmc=1,xbr=2,scale=s=320x256:force_original_aspect_ratio=decrease:sws_flags=spline+accurate_rnd+full_chroma_int+full_chroma_inp:sws_dither=2:in_range=1:out_range=1,format=pix_fmts=yuv420p"
    Quote Quote  
  8. Member
    Join Date
    Mar 2011
    Location
    Paris, France
    Search PM
    The problem is that speeding up video+audio requires a complex filter:

    Code:
    ffmpeg -i input.mp4 -vf "scale=640:-1,format=pix_fmts=yuv420p" -filter_complex "[0:v]setpts=0.5*PTS[v];[0:a]atempo=2.0[a]" -map "[v]" -map "[a]" output.mp4
    
    Filtergraph 'scale=640:-1,format=pix_fmts=yuv420p' was specified through the -vf/-af/-filter option for output stream 0:0, which is fed from a complex filtergraph. -vf/-af/-filter and -filter_complex cannot be used together for the same stream.
    Quote Quote  
  9. works for me...
    Code:
    @set OUTDIR="out"
    @if not exist %OUTDIR% (mkdir %OUTDIR%)
    @ffmpeg -i "%1" -vf "scale=720:404,setpts=0.5*PTS" -af "atempo=2.0" -c:a pcm_s16le -c:v huffyuv -f matroska "%OUTDIR%\output.sped.up.mkv"
    Quote Quote  
  10. Member
    Join Date
    Mar 2011
    Location
    Paris, France
    Search PM
    Thanks !

    ffmpeg -i input.mp4 -c:v libx264 -vf "scale=720:-1,setpts=0.5*PTS,format=pix_fmts=yuv420p" -af "atempo=2.0" -c:a aac -b:a 128k -ac 2 -ar 44100 -threads 2 -f mp4 output.mp4
    Quote Quote  
  11. Originally Posted by yetanotherlogin View Post
    Thanks !

    ffmpeg -i input.mp4 -c:v libx264 -vf "scale=720:-1,setpts=0.5*PTS,format=pix_fmts=yuv420p" -af "atempo=2.0" -c:a aac -b:a 128k -ac 2 -ar 44100 -threads 2 -f mp4 output.mp4
    IMHO better like this:

    Code:
    ffmpeg -threads 2 -i input.mp4 -c:v libx264 -vf "scale=720:-2,setpts=0.5*PTS,format=pix_fmts=yuv420p" -af "atempo=2.0" -c:a aac -b:a 128k -ac 2 -ar 44100 -f mp4 output.mp4
    Quote Quote  



Similar Threads

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