0

I have been working with below environment.

Ubuntu 16.04.3

FFmpeg: 3.4.2

-- configuration: --prefix=/usr/local/ffmpeg_new/ --enable-cuda --enable-cuvid --enable-nvenc --enable-nonfree --enable-libnpp --extra-cflags=-I/usr/local/cuda/include --extra-ldflags=-L/usr/local/cuda/lib64 --enable-libvpx --enable-libvorbis --enable-libfreetype

Cuda 9.1.85

GPU: GeForce GTX 1080ti

I have two media files : caller_video.webm (80MB) and callee_video.webm (120MB)

Then I am demuxing audios from these videos via below command:

time ffmpeg -y -i caller.webm -vn -ab 256 caller.wav

Caller.wav = 260 MB

Then, muxing caller.wav file with callee_video.webm

time ffmpeg -y -i callee_video.webm -i caller.wav -filter_complex '[0:a]aformat=sample_fmts=fltp:sample_rates=44100:channel_layouts=stereo,volume=0.5[a1]; [1:a]aformat=sample_fmts=fltp:sample_rates=44100:channel_layouts=stereo,volume=0.5[a2]; [a1][a2]amerge,pan=stereo|c0<c0+c2|c1<c1+c3[out]' -map 0:v -map '[out]' -c:v copy  tempfile.mkv

File Size of tempfile : 87MB

Then, I am encoding the temp file via below command:

time ffmpeg -y -i temp_file.mkv    -pixel_format yuv444p -preset default  -vf  drawtext=fontfile=/usr/share/fonts/truetype/dejavu/DejaVuSans-Bold.ttf:x=8:y=8:fontsize=16:fontcolor=yellow@1:expansion=strftime:basetime=1518172680000000:text='%Y-%m-%d %H-%M-%S'  -acodec libvorbis  -c:v h264_nvenc   final_video.mkv

Final_video Size: 270 MB

The thing I am trying to understand is that when I encode the orig webm file which is 80MB,the encoded output mkv file size ~20MB .

Yet, when I performed the same operation on muxed temp media file(callee_video.webm + caller.wav) that the size is 87MB before encoding, becomes 270MB.

What I am missing or doing wrong?

7
  • Your question is very hard to read. Please make sure you use proper formatting for commands (see the formatting help and use the preview). Are you asking why when you go from temp_file.mkv to final_video.mkv the size changes from 87MB to 270MB?
    – slhck
    Apr 17, 2018 at 8:38
  • Sorry for the format in the commands.Yes,you understand correct, the question is why the final output size goes to 270 MB while the temp file size 87MB. Apr 17, 2018 at 8:52
  • Format of the commands are edited. Apr 17, 2018 at 8:55
  • You haven't specified any quality or bitrate setting for your encoding command, so it's up to the encoder to choose it. This may result in a larger bitrate. What is your goal – should the files have a certain constant bitrate? Should they be as small as possible with the best quality? Or do you want to keep the quality as good as possible?
    – slhck
    Apr 17, 2018 at 8:57
  • Trying to figure out the best rate with performance and storage perspective of view. However, when I have run the same command with out gpu included for webm output instead of mkv,output size becomes around 60MB which is fare enough. So,what exact parameter should I add to command to get small size mkv output ,do you have any recommendation. Apr 17, 2018 at 9:38

1 Answer 1

0

You haven't specified any quality or bitrate setting for your encoding command, so it's up to the encoder to choose it. This may result in a larger bitrate.

You could specify -b:v 1M to use a single-pass average bitrate encode at 1 Mbit/s. The bitrate will depend on the size of the video and your quality requirements.

You can also use -qp 23 to perform a variable-bitrate fixed-quality encode at QP 23. Higher QP means lower quality and vice-versa.

See ffmpeg -h encoder=h264_nvenc for possible options for the encoder.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .