Home/News | About | Download | Documentation | Forum | Bug Reports | Contact | Donations | Consulting | Projects | Legal | Security | FATE


This forum has not been maintained for a long time and will probably get deleted in the near future.
For faster responses to your questions, please use StackOverflow instead and tag your questions with "FFmpeg".
If you need a backup of the posts from this forum, please contact me directly.

[SOLVED] How to 1) resize and 2) speed up, in one go?

Discussions about problems encountered using ffmpeg.
Forum rules
FFmpeg is in a state of perpetual development and we do not currently have the person power to backport fixes to official releases. As such, if you wish to query or report a bug, you must try with the latest development branch revision of FFmpeg to confirm the issue still exists. The latest FFmpeg can be downloaded from here: http://www.ffmpeg.org/download.html

[SOLVED] How to 1) resize and 2) speed up, in one go?

Postby Winfried » Fri Aug 25, 2017 10:15 pm

Hello,

I'd like to reduce the screen size of an MP4 video to 720x?, and speed up the video to eg. 2x.

This fails:
Code: Select all
c:\>ffmpeg.exe -i input.mp4 -filter:v 'scale=720:404' -filter:v 'setpts=0.5*PTS' -filter:a 'atempo=2' -threads 2 -f mp4 output.mp4

ffmpeg version 3.3.1 Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 6.3.0 (GCC)
  configuration: --enable-gpl --enable-version3 --enable-cuda --enable-cuvid --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-nvenc --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzimg --enable-lzma --enable-zlib
  libavutil      55. 58.100 / 55. 58.100
  libavcodec     57. 89.100 / 57. 89.100
  libavformat    57. 71.100 / 57. 71.100
  libavdevice    57.  6.100 / 57.  6.100
  libavfilter     6. 82.100 /  6. 82.100
  libswscale      4.  6.100 /  4.  6.100
  libswresample   2.  7.100 /  2.  7.100
  libpostproc    54.  5.100 / 54.  5.100
Invalid UE golomb code
[h264 @ 0434f0c0] Overread VUI by 8 bits
[h264 @ 0434f0c0] SPS decoding failure, trying again after escaping the NAL
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'input.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: mp42isom
    creation_time   : 2017-08-25T19:38:56.000000Z
  Duration: 00:02:10.88, start: 0.000000, bitrate: 5577 kb/s
    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720
[SAR 1:1 DAR 16:9], 5444 kb/s, 24.98 fps, 25 tbr, 90k tbn, 50 tbc (default)
    Metadata:
      creation_time   : 2017-08-25T19:38:57.000000Z
      encoder         : JVT/AVC Coding
    Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      creation_time   : 2017-08-25T19:38:57.000000Z
Invalid UE golomb code
[h264 @ 0320de60] Overread VUI by 8 bits
[h264 @ 0320de60] SPS decoding failure, trying again after escaping the NAL
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[AVFilterGraph @ 0441fd40] No such filter: 'setpts=0.5*PTS'
Error reinitializing filters!
Failed to inject frame into filter network: Invalid argument
Error while processing the decoded data for stream #0:0
Conversion failed!


So ffmpeg says "[AVFilterGraph @ 0441fd40] No such filter: 'setpts=0.5*PTS'".

Should I run ffmpeg twice, once for each command?

Thank you.
Last edited by Winfried on Sat Aug 26, 2017 10:55 am, edited 1 time in total.
Winfried
 
Posts: 6
Joined: Thu Jul 19, 2012 10:58 pm

Re: How to 1) resize and 2) speed up, in one go?

Postby Winfried » Fri Aug 25, 2017 10:52 pm

The work-around is to run the command twice:

Code: Select all
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
Winfried
 
Posts: 6
Joined: Thu Jul 19, 2012 10:58 pm

Re: How to 1) resize and 2) speed up, in one go?

Postby Winfried » Sat Aug 26, 2017 10:55 am

A better solution:

Code: Select all
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
Winfried
 
Posts: 6
Joined: Thu Jul 19, 2012 10:58 pm


Return to ffmpeg

Who is online

Users browsing this forum: Google [Bot] and 6 guests