0

I use this command to create "myFile.webm", a VP9 video with one still image :

$ ffmpeg -i myOriginialPureAudioFile.opus -loop 1 -i myAudioFile_640x360.png -shortest -threads 4 -speed max -c:a copy myFile.webm
Input #0, ogg, from 'myOriginialPureAudioFile.opus':
  Duration: 01:53:19.80, start: 0.000000, bitrate: 24 kb/s
    Stream #0:0(eng): Audio: opus, 48000 Hz, mono, fltp
    Metadata:
      LANGUAGE        : eng
      TITLE           : unnamed
      ENCODER         : Lavf57.83.100
Input #1, png_pipe, from 'myAudioFile_640x360.png':
  Duration: N/A, bitrate: N/A
    Stream #1:0: Video: png, rgb24(pc), 640x360 [SAR 72:72 DAR 16:9], 25 fps, 25 tbr, 25 tbn, 25 tbc
File 'myFile.webm' already exists. Overwrite ? [y/N] y
Stream mapping:
  Stream #1:0 -> #0:0 (png (native) -> vp9 (libvpx-vp9))
  Stream #0:0 -> #0:1 (copy)
Press [q] to stop, [?] for help
[libvpx-vp9 @ 0x5655578268c0] v1.3.0
Output #0, webm, to 'myFile.webm':
  Metadata:
    encoder         : Lavf57.83.100
    Stream #0:0: Video: vp9 (libvpx-vp9), yuv420p, 640x360 [SAR 1:1 DAR 16:9], q=-1--1, 200 kb/s, 25 fps, 1k tbn, 25 tbc
    Metadata:
      encoder         : Lavc57.107.100 libvpx-vp9
    Side data:
      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
    Stream #0:1(eng): Audio: opus, 48000 Hz, mono, fltp
    Metadata:
      LANGUAGE        : eng
      TITLE           : unnamed
      ENCODER         : Lavf57.83.100
frame= 4863 fps= 22 q=0.0 Lsize=     987kB time=00:03:14.48 bitrate=  41.6kbits/s speed=0.879x

The speed is about 0.88x, how can I make this encoding much faster ?

6
  • 1
    Why use VP9? x264?
    – Gyan
    Commented Nov 21, 2018 at 11:09
  • @Gyan Because, I don't want to re-encode the 2hours audio which in opus format. I use -c:a copy because the WebM container supports opus audio
    – SebMa
    Commented Nov 21, 2018 at 17:31
  • 1
    So does MP4 with -strict -2 added.
    – Gyan
    Commented Nov 21, 2018 at 17:39
  • @Gyan I don't think YouTube is going to accept an MP4 file with opus audio
    – SebMa
    Commented Nov 21, 2018 at 17:42
  • 1
    Try a very short file.
    – Gyan
    Commented Nov 21, 2018 at 18:13

2 Answers 2

1

On my machine, speed=0.953x while using the default setting

c:\ffmpeg\ffmpeg -y -i out_music.opus -loop 1 -i temp.png -shortest -threads 4 -speed max -c:a copy  myFile.webm

frame=  184 fps= 24 q=0.0 Lsize=     843kB time=00:00:07.32 bitrate= 943.8kbits/s speed=0.953x

speed=1.73x while using the realtime setting

c:\ffmpeg\ffmpeg -y -i out_music.opus -loop 1 -i temp.png -shortest -threads 4 -speed max -c:a copy -deadline realtime myFile.webm

frame=  491 fps= 43 q=0.0 Lsize=    1809kB time=00:00:19.60 bitrate= 755.9kbits/s speed=1.73x

Since the input is a png file, frame per second could be lower; speed=5.84x while using the fps=5 setting

c:\ffmpeg\ffmpeg -y -i out_music.opus -loop 1 -i temp.png -shortest -threads 4 -speed max -c:a copy -deadline realtime -vf fps=5 myFile.webm

frame=  218 fps= 29 q=0.0 Lsize=    1316kB time=00:00:43.40 bitrate= 248.3kbits/s speed=5.84x

Reference:https://trac.ffmpeg.org/wiki/Encode/VP9

1
  • Just for information. According to ffmpeg filters documentation on the fps filter, -vf fps=5 would be equivalent to -r 5 as an output option, read man ffmpeg | sed -n "/-r.:/,/output option/p"
    – SebMa
    Commented Dec 8, 2021 at 19:18
0

One solution (found here) is to use a very small -framerate value.

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.