1

I am using FFMPEG to convert video files to mpg format. Conversion works fine for audio content, but the output has no video content. This is the parameters I am using:

ffmpeg.exe -i "<Path to input file>"  -y -s 640x360 -b:v 1024k -vcodec libx264 -r 29.7 -movflags faststart -pix_fmt yuv420p "output.mpg"

Am I missing something?

Here is the console output:

C:\Users\Sharun>"C:\Program Files\ImageMagick-6.8.8-Q16\ffmpeg.exe" -i "D:\SampleFiles\sampleavifile.avi" -y -s 640x360 -b:v 1024k -vcodec libx264 -r 29.7 -movflags faststart -pix_fmt yuv420p "D:\SampleFiles\eFileName.mpg"

ffmpeg version N-69711-g60bb893 Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.9.2 (GCC) 
configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab le-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca -- enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-lib modplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrw b --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinge r --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --en able-libvidstab --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable- libx265 --enable-libxavs --enable-libxvid --enable-lzma --enable-decklink --enab le-zlib
libavutil 54. 18.100 / 54. 18.100 
libavcodec 56. 21.102 / 56. 21.102
libavformat 56. 19.101 / 56. 19.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 10.100 / 5. 10.100
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 1.100 / 1. 1.100
libpostproc 53. 3.100 / 53. 3.100
[avi @ 00000000045bd060] non-interleaved AVI
[mpeg4 @ 00000000045bde40] looks like this file was encoded with (divx4/(old)xvi d/opendivx) -> forcing low_delay flag
Input #0, avi, from 'D:\SampleFiles\sampleavifile.avi':
    Duration: 00:01:27.60, start: 0.000000, bitrate: 1064 kb/s
      Stream #0:0: Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D), yuv420p, 135 6x732 [SAR 1:1 DAR 113:61], 1059 kb/s, 20 fps, 20 tbr, 20 tbn, 100 tbc
[libx264 @ 0000000004990520] using SAR=1017/976
[libx264 @ 0000000004990520] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX 
[libx264 @ 0000000004990520] profile High, level 3.0
[mpeg @ 00000000045bb280] VBV buffer size not set, using default size of 130KB 
If you want the mpeg file to be compliant to some specification 
Like DVD, VCD or others, make sure you set the correct buffer size
Output #0, mpeg, to 'D:\SampleFiles\eFileName.mpg': 
  Metadata:
    encoder : Lavf56.19.101 
  Stream #0:0: Video: h264 (libx264), yuv420p, 640x360 [SAR 1017:976 DAR 113:6 1], q=-1--1, 1024 kb/s, 29.70 fps, 90k tbn, 29.70 tbc 
    Metadata: 
      encoder : Lavc56.21.102 libx264 
    Stream mapping: 
    Stream #0:0 -> #0:0 (mpeg4 (native) -> h264 (libx264))
Press [q] to stop, [?] for help 
[mpeg4 @ 00000000046974a0] looks like this file was encoded with (divx4/(old)xvi d/opendivx) -> forcing low_delay flag 
frame= 173 fps=0.0 q=0.0 size= 110kB time=00:00:04.07 bitrate= 221.2kbits/s 
frame= 317 fps=315 q=0.0 size= 328kB time=00:00:08.92 bitrate= 301.1kbits/s
frame= 475 fps=314 q=0.0 size= 466kB time=00:00:14.24 bitrate= 268.0kbits/s

-------- omitted some lines in between

[libx264 @ 0000000004990520] ref B L0: 45.2% 31.7% 23.2% 
[libx264 @ 0000000004990520] ref B L1: 72.3% 27.7% 
[libx264 @ 0000000004990520] kb/s:288.20

C:\Users\Sharun>
0

2 Answers 2

2

The .mpg container is for MPEG-1 & MPEG-2 encoding:

  • If you wish to encode h.264 you should use .mp4.

  • If you wish create a .mpg file then omit the codec options, ffmpeg will produce MPEG-2.

1
  • Just like you said, I had to omit the codec options. I was previously using the parameters for mp4 and forget to omit them. Thanks.
    – Sharun
    May 29, 2015 at 8:34
0

You also do not need "" for anything that does not have spaces in the path or file name; the extra "" I will assume is just you hiding the filename possibly. You also do not need anything other than:

ffmpeg.exe -i samplemovie.avi -c:v libx264 -c:a copy filename.mp4

If you wished to specify quality you'd most likely go the CRF route, such as:

ffmpeg.exe -i samplemovie.avi -c:v libx264 -preset slow -crf 23 -c:a copy filename.mp4

CRF: H264 default is 23 the lower you go the better the quality (23 works for > up to 1080p for me nicely have never had need for 4k video though)

Preset: This turns on and off certain compression and other features of the encoder. The slower preset chosen the smaller the file and longer the encode takes). Possible presets: ultrafast superfast veryfast faster fast medium(default) slow slower veryslow placebo

You could also use tune too although that never does much for me (other than maybe using animation for cartoons - aside from that you can usually ignore this without any issues).

You must log in to answer this question.

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