0

I have this 3hrs long mkv video file that has a ridiculous size even for 1080p resolution (more than 30gigs), so I want to shrink it a little bit. Looking at the video information on smplayer it says that its format is MPG2 and codec is FFmpeg. Bitrate is huge: over 20k. That explains the size of the file I guess. Audio codec is PCM.

So I tried—in order to reduce the size as much as possible—to convert it to H264 MP4 while lowering bit rate and resolution as well as audio quality using the following command:

ffmpeg -i inputfile.mkv -vcodec h264 -vf scale=1600:900 -b:v 6000k -acodec aac -b:a 128k -ar 44100 outputfile.mp4

The version of FFmpeg I am using is 3.3.6. I haven’t had any trouble reencoding other formats to h264 before and the resulting output file plays nice... at first, the change in video quality is almost unnoticeable, same for audio quality plus the size of the file looks reasonable. image and audio are synced. Good.

Now, the issue is that the motion is a little bit slower than the source file. Slower enough to be noticeable and to annoy me. I can’t explain why since video has the same length. It's not that the output file has lower FPS or anything.

So I hope you can give me an advice at how to properly convert this particular input format? I also tried to lower the bit rate of the source file without changing its format but the resulting video looked terrible and the size of it was still huge.

edit: added ffprobe readouts for both inputfile and outfile. What's on italic is blue, what's on bold is red on my console.

$ ffprobe inputfile.mkv
ffprobe version 3.3.6 Copyright (c) 2007-2017 the FFmpeg developers
built with gcc 6.3.0 (Debian 6.3.0-18) 20170516
configuration: --disable-decoder=amrnb --disable-decoder=libopenjpeg --disable-mips32r2 --disable-mips32r6 --disable-mips64r6 --disable-mipsdsp --disable-mipsdspr2 --disable-mipsfpu --disable-msa --disable-libopencv --disable-podpages --disable-stripping --enable-avfilter --enable-avresample --enable-gcrypt --enable-gnutls --enable-gpl --enable-libass --enable- libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable- libfdk-aac --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libilbc --enable-libkvazaar --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable- libopus --enable-libpulse --enable-librubberband --enable-libshine --enable- libsnappy --enable-libsoxr --enable-libspeex --enable-libtesseract --enable- libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx265 --enable-libxvid --enable-libzvbi --enable- nonfree --enable-opengl --enable-openssl --enable-postproc --enable-pthreads --enable-shared --enable-version3 --incdir=/usr/include/x86_64-linux-gnu --libdir=/usr/lib/x86_64-linux-gnu --prefix=/usr --toolchain=hardened --enable-frei0r --enable-chromaprint --enable-libx264 --enable-libiec61883 --enable-libdc1394 --enable-vaapi --disable-opencl --enable-libmfx --disable- altivec --shlibdir=/usr/lib/x86_64-linux-gnu
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
libavresample 3. 5. 0 / 3. 5. 0
libswscale 4. 6.100 / 4. 6.100
libswresample 2. 7.100 / 2. 7.100
libpostproc 54. 5.100 / 54. 5.100
[mpeg2video @ 0x78df96dec0] ignoring pic cod ext after 0
Input #0, matroska,webm, from 'inputfile.mkv': Metadata: encoder : libebml v1.3.0 + libmatroska v1.4.1 creation_time : 2014-05-22T01:36:37.000000Z Duration: 03:10:45.71, start: 0.000000, bitrate: 22858 kb/s Stream #0:0: Video: mpeg2video (Main), yuv420p(tv, bt709, top first), 1920x1080 [SAR 1:1 DAR 16:9], 22200 kb/s, 59.94 fps, 59.94 tbr, 1k tbn, 59.94 tbc (default) Stream #0:1(eng): Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s (default)

$ ffprobe outputfile.mp4
ffprobe version 3.3.6 Copyright (c) 2007-2017 the FFmpeg developers
built with gcc 6.3.0 (Debian 6.3.0-18) 20170516
configuration: --disable-decoder=amrnb --disable-decoder=libopenjpeg --disable-mips32r2 --disable-mips32r6 --disable-mips64r6 --disable-mipsdsp --disable-mipsdspr2 --disable-mipsfpu --disable-msa --disable-libopencv --disable-podpages --disable-stripping --enable-avfilter --enable-avresample --enable-gcrypt --enable-gnutls --enable-gpl --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libfdk-aac --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libilbc --enable-libkvazaar --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenh264 --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx265 --enable-libxvid --enable-libzvbi --enable-nonfree --enable-opengl --enable-openssl --enable-postproc --enable-pthreads --enable-shared --enable-version3 --incdir=/usr/include/x86_64-linux-gnu --libdir=/usr/lib/x86_64-linux-gnu --prefix=/usr --toolchain=hardened --enable-frei0r --enable-chromaprint --enable-libx264 --enable-libiec61883 --enable-libdc1394 --enable-vaapi --disable-opencl --enable-libmfx --disable-altivec --shlibdir=/usr/lib/x86_64-linux-gnu
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
libavresample 3. 5. 0 / 3. 5. 0
libswscale 4. 6.100 / 4. 6.100
libswresample 2. 7.100 / 2. 7.100
libpostproc 54. 5.100 / 54. 5.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'outputfile.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.71.100
Duration: 03:10:45.73, start: 0.000000, bitrate: 6146 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1600x900 [SAR 1:1 DAR 16:9], 6004 kb/s, 59.94 fps, 59.94 tbr, 19001 tbn, 119.88 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 126 kb/s (default)
Metadata:
handler_name : SoundHandler

  • Paste the readouts of ffprobe inputfile.mkv and ffprobe outputfile.mp4 – Gyan Mar 25 '18 at 4:49
  • Done, they're in the main post now. Thanks. – midish Mar 26 '18 at 18:27

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Browse other questions tagged or ask your own question.