1

I'm trying to re-encode a video produced with "TechSmith Screen Capture Codec" in WinUAE to use H.264 video and AAC audio, with the latest "ffmpeg" (20200510-fc99a24) 64-bit, but when I use the following line with ffmpeg, it seems to encode OK, but results in a video file that doesn't play on anything:

"C:\Program Files\ffmpeg\bin\ffmpeg.exe" -i output.avi -vcodec libx264 -preset slow -crf 20 -acodec mp3 -b:a 160k done.mkv

I realise the audio is MP3, but I don't know how to use AAC in ffmpeg.

What is going wrong?

4

Add -c:a aac:

ffmpeg -i input.avi -c:v libx264 -preset slow -crf 20 -c:a aac -b:a 160k -vf format=yuv420p -movflags +faststart output.mp4
  • input.avi is the input file.
  • -c:v libx264 selects the video encoder libx264, which is a H.264 encoder.
  • -preset slow selects the slow x264 encoding preset. Default preset is medium. Use the slowest preset that you have patience for.
  • -crf 20 selects a CRF value of 20 which will result in a high quality output. Default value is 23. A lower value is a higher quality. Use the highest value that gives an acceptable quality.
  • -c:a aac selects the audio encoder aac, which is the built-in FFmpeg AAC encoder.
  • -b:a 160k encodes the audio with a bitrate of 160k.
  • -vf format=yuv420p chooses YUV 4:2:0 chroma-subsampling which is recommended for H.264 compatibility.
  • -movflags +faststart is an option for MP4 output that move some data to the beginning of the file after encoding is finished. This allows the video to begin playing faster if it is watched via progressive download playback.
  • output.mp4 is the output file.

See FFmpeg Wiki: H.264 and FFmpeg Wiki: AAC for more info.

0
ffmpeg -i input -c:v libx264 -b:v 2600k -pass 2 -c:a aac -b:a 128k output.mp4

from the official ffmpeg documentation.

1
  • Why suggest two-pass?
    – llogan
    May 12 '20 at 18:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.