0

A frequent task is to render a 5–30 minutes video from a single image + soundtrack and then append a pre-rendered outro logo animation sequence.

Output is hd720 h264 mp4 for YouTube.

What would be the fastest aproach to combine a lo-motion static image part with motion-intensive tail animation and produce a quality result?

I tried rendering the image part and then concat the outro:

ffmpeg       \
  -loop 1    \
  -r 24      \
  -i $IMAGE  \
  -i $AUDIO  \
  -t $AUDIO_LENGTH  \
  -c:a aac   \
  -profile:a aac_low  \
  -ar 48000  \
  -b:a 192k  \
  -bsf:a aac_adtstoasc  \
  -strict -2 -y  \
  -c:v libx264  \
  -profile:v high  \
  -preset veryfast  \
  -tune stillimage  \
  -crf 24  \
  -x264opts bframes=2  \
  -pix_fmt yuv420p  \
  -safe 0  \
  $RENDER

ffmpeg  \
  -f concat  \
  -safe 0  \
  -i <(printf "file '%s'\n" ${RENDER} ${OUTRO})  \
  -c copy  \
  -y  \
  ${OUTPUT}

This renders rather fast but the appended logo reveal gets garbled. That's because of the h264 compression settings, I guess.

Maybe I could somehow imitate the two-pass rendering of h264 mp4? I know the exact length of the first part and it contains zero motion. There's the second animation and I can "prepare" the 1st pass for it ahead.

Please advice, how would a ffmpeg Pro aproach the task?

Upd. here are the properties of the appended outro:

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'outro.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf55.14.101
  Duration: 00:00:03.19, start: 0.000000, bitrate: 263 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 77 kb/s, 24 fps, 24 tbr, 12288 tbn (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 181 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
2
  • Show the file properties of the outro.
    – Gyan
    Commented Oct 3, 2017 at 12:21
  • @Mulvya thank you for the attention! I updated the question with outro file properties. I wonder if there a way to build an mp4 file with two distinct compressions settings for the two parts?
    – Serge
    Commented Oct 3, 2017 at 13:00

1 Answer 1

1

As I can see, you know duration of your song, it good.

I can suggest this trick:

  1. Generate 5 second of video with static image. With good settings, good fps, slow encoding and so on. Video must be without audio.

  2. Join this video with itself as many times, as you want, so duration will be a little more of your clip. This operation not requires reencoding, so can be performed very fast.

  3. Split your clip to exact size as you need. (no re-encoding)

  4. Join outro to file

  5. Join your file with audio (without re-encoding for video, but audio you can modify based on your needs. If you want to upload it to youtube, you can not reencode audio, youtube does it itself)

This can be pretty fast.

2
  • Thank you for the suggestion! Will try soon and report here. Which container/codec, capable of the fastest concat protocol concat:video1|video2|video3 do you recommend? I used huffyuv recently, but not sure which is better. Disk space is not limited.
    – Serge
    Commented Oct 3, 2017 at 18:21
  • 1
    huffyuv is codec, not container. Try to use avi, I love this old container. Codec must be x264 or any other which you want in final video
    – bukkojot
    Commented Oct 3, 2017 at 18:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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