Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am using this command to convert videos from M4V and AVI to FLV:

ffmpeg -i 'video_1355440448.m4v' -s '640x360' -ab '64k' -ar '44100' -q:v '1' -f 'flv' -y video_1355440448.flv

I have two servers:

  • one server with FFmpeg version N-48249-g5079568, where the videos works fine.
  • another server with FFmpeg version N-48332-gfe5a2fc, where the videos are not working fine.

There are no errors in both servers and both servers convert videos of the same size. If I click to play this video, it pauses for buffering and starts 30 seconds or so later.

One server shows which part is loaded with a black line, but the other server doesn't show this.

I found something One server have

[root@server ~]# whereis ffmpeg
ffmpeg: /usr/local/bin/ffmpeg
[root@server ~]# whereis mencoder
mencoder: /usr/local/bin/mencoder
[root@server ~]# whereis flvtool2
flvtool2: /usr/bin/flvtool2
[root@server ~]# 

another server

machine@machinerytube.com [~]# whereis ffmpeg
ffmpeg: /usr/local/bin/ffmpeg
machine@machinerytube.com [~]# whereis mencoder
mencoder:
machine@machinerytube.com [~]# whereis flvtool2
flvtool2:
machine@machinerytube.com [~]# 

First server:

[root@server ~]# ffmpeg -i '/home/indus33/public_html/machine_manuals/zindagi.avi' -s '640x360' -ab '64k' -ar '44100' -f 'flv' -q:v '1' -y /home/indus33/public_html/machine_manuals/video_zindagi.flv
ffmpeg version N-48249-g5079568 Copyright (c) 2000-2012 the FFmpeg developers
built on Dec 28 2012 11:45:15 with gcc 4.4.6 (GCC) 20120305 (Red Hat 4.4.6-4)
configuration: --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvpx --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-gpl --enable-postproc --enable-nonfree
  libavutil 52. 12.100 / 52. 12.100
  libavcodec 54. 81.100 / 54. 81.100
  libavformat 54. 50.104 / 54. 50.104
  libavdevice 54. 3.102 / 54. 3.102
  libavfilter 3. 30.101 / 3. 30.101
  libswscale 2. 1.103 / 2. 1.103
  libswresample 0. 17.102 / 0. 17.102
  libpostproc 52. 2.100 / 52. 2.100
[avi @ 0x27f5900] non-interleaved AVI
Guessed Channel Layout for Input Stream #0.1 : stereo
Input #0, avi, from '/home/indus33/public_html/machine_manuals/zindagi.avi':
  Metadata:
    encoder : Lavf54.6.100
  Duration: 00:02:10.44, start: 0.000000, bitrate: 824 kb/s
  Stream #0:0: Video: msmpeg4v2 (MP42 / 0x3234504D), yuv420p, 320x240, 25 tbr, 25 tbn, 25 tbc
  Stream #0:1: Audio: adpcm_ms ([2][0][0][0] / 0x0002), 44100 Hz, stereo, s16, 352 kb/s
Output #0, flv, to '/home/indus33/public_html/machine_manuals/video_zindagi.flv':
  Metadata:
    encoder : Lavf54.50.104
  Stream #0:0: Video: flv1 ([2][0][0][0] / 0x0002), yuv420p, 640x360, q=2-31, 200 kb/s, 1k tbn, 25 tbc
  Stream #0:1: Audio: mp3 ([2][0][0][0] / 0x0002), 44100 Hz, stereo, s16p, 64 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (msmpeg4v2 -> flv)
  Stream #0:1 -> #0:1 (adpcm_ms -> libmp3lame)
Press [q] to stop, [?] for help
frame= 155 fps=0.0 q=1.0 size= 2109kB time=00:00:06.24 bitrate=2768.6kbits/sframe= 291 fps=290 q=1.0 size= 4659kB time=00:00:11.68 bitrate=3267.5kbits/sframe= 419 fps=279 q=1.0 size= 6979kB time=00:00:16.80 bitrate=3403.0kbits/sframe= 561 fps=280 q=1.0 size= 9508kB time=00:00:22.48 bitrate=3464.7kbits/sframe= 711 fps=284 q=1.0 size= 11691kB time=00:00:28.48 bitrate=3362.9kbits/sframe= 857 fps=285 q=1.0 size= 14044kB time=00:00:34.32 bitrate=3352.3kbits/sframe= 1005 fps=287 q=1.0 size= 16310kB time=00:00:40.24 bitrate=3320.4kbits/sframe= 1155 fps=288 q=1.0 size= 18344kB time=00:00:46.24 bitrate=3249.9kbits/sframe= 1303 fps=289 q=1.0 size= 20685kB time=00:00:52.16 bitrate=3248.7kbits/sframe= 1452 fps=290 q=1.0 size= 23081kB time=00:00:58.12 bitrate=3253.3kbits/sframe= 1585 fps=288 q=1.0 size= 25946kB time=00:01:03.44 bitrate=3350.4kbits/sframe= 1725 fps=287 q=1.0 size= 28713kB time=00:01:09.04 bitrate=3406.9kbits/sframe= 1863 fps=286 q=1.0 size= 30890kB time=00:01:14.56 bitrate=3393.9kbits/sframe= 2008 fps=286 q=1.0 size= 33400kB time=00:01:20.36 bitrate=3404.8kbits/sframe= 2150 fps=286 q=1.0 size= 36046kB time=00:01:26.04 bitrate=3432.0kbits/sframe= 2292 fps=286 q=1.0 size= 38434kB time=00:01:31.72 bitrate=3432.8kbits/sframe= 2443 fps=287 q=1.0 size= 40747kB time=00:01:37.76 bitrate=3414.5kbits/sframe= 2590 fps=287 q=1.0 size= 43170kB time=00:01:43.64 bitrate=3412.3kbits/sframe= 2730 fps=287 q=1.0 size= 45488kB time=00:01:49.24 bitrate=3411.2kbits/sframe= 2871 fps=287 q=1.0 size= 48315kB time=00:01:54.88 bitrate=3445.3kbits/sframe= 2988 fps=283 q=1.0 size= 50770kB time=00:01:59.56 bitrate=3478.7kbits/sframe= 3131 fps=283 q=1.0 size= 53303kB time=00:02:05.28 bitrate=3485.4kbits/sframe= 3260 fps=283 q=1.0 Lsize= 55572kB time=00:02:10.45 bitrate=3489.6kbits/s
video:54423kB audio:1019kB subtitle:0 global headers:0kB muxing overhead 0.233212%

Other server:

machine@machinerytube.com [~]# ffmpeg -i '/home/machine/public_html/sterlingadmin/files/zindagi.avi' -s '640x360' -ab '64k' -ar '44100' -f 'flv' -q:v '1' -y /home/machine/public_html/sterlingadmin/files/video_zindagi_old.flv
ffmpeg version N-48332-gfe5a2fc Copyright (c) 2000-2012 the FFmpeg developers
built on Dec 30 2012 23:42:22 with gcc 4.1.2 (GCC) 20080704 (Red Hat 4.1.2-52)
configuration: --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvpx --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-gpl --enable-postproc --enable-nonfree --enable-shared --extra-cflags=-fPIC
libavutil 52. 13.100 / 52. 13.100
libavcodec 54. 85.100 / 54. 85.100
libavformat 54. 57.100 / 54. 57.100
libavdevice 54. 3.102 / 54. 3.102
libavfilter 3. 30.102 / 3. 30.102
libswscale 2. 1.103 / 2. 1.103
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 2.100 / 52. 2.100
[avi @ 0x16d55900] non-interleaved AVI
Guessed Channel Layout for Input Stream #0.1 : stereo
Input #0, avi, from '/home/machine/public_html/sterlingadmin/files/zindagi.avi':
  Metadata:
    encoder : Lavf54.6.100
  Duration: 00:02:10.44, start: 0.000000, bitrate: 824 kb/s
  Stream #0:0: Video: msmpeg4v2 (MP42 / 0x3234504D), yuv420p, 320x240, 25 tbr, 25 tbn, 25 tbc
  Stream #0:1: Audio: adpcm_ms ([2][0][0][0] / 0x0002), 44100 Hz, stereo, s16, 352 kb/s
Output #0, flv, to '/home/machine/public_html/sterlingadmin/files/video_zindagi_old.flv':
  Metadata:
    encoder : Lavf54.57.100
  Stream #0:0: Video: flv1 ([2][0][0][0] / 0x0002), yuv420p, 640x360, q=2-31, 200 kb/s, 1k tbn, 25 tbc
  Stream #0:1: Audio: mp3 ([2][0][0][0] / 0x0002), 44100 Hz, stereo, s16p, 64 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (msmpeg4v2 -> flv)
  Stream #0:1 -> #0:1 (adpcm_ms -> libmp3lame)
Press [q] to stop, [?] for help
frame= 72 fps=0.0 q=1.0 size= 911kB time=00:00:02.92 bitrate=2554.8kbits/sframe= 149 fps=149 q=1.0 size= 2036kB time=00:00:06.00 bitrate=2780.2kbits/sframe= 210 fps=139 q=1.0 size= 3060kB time=00:00:08.44 bitrate=2969.6kbits/sframe= 277 fps=138 q=1.0 size= 4343kB time=00:00:11.12 bitrate=3199.3kbits/sframe= 346 fps=138 q=1.0 size= 5802kB time=00:00:13.88 bitrate=3424.4kbits/sframe= 417 fps=138 q=1.0 size= 6944kB time=00:00:16.72 bitrate=3402.3kbits/sframe= 487 fps=139 q=1.0 size= 8066kB time=00:00:19.52 bitrate=3384.9kbits/sframe= 556 fps=139 q=1.0 size= 9435kB time=00:00:22.28 bitrate=3468.9kbits/sframe= 641 fps=142 q=1.0 size= 10663kB time=00:00:25.68 bitrate=3401.6kbits/sframe= 730 fps=146 q=1.0 size= 11968kB time=00:00:29.24 bitrate=3353.0kbits/sframe= 812 fps=147 q=1.0 size= 13357kB time=00:00:32.52 bitrate=3364.6kbits/sframe= 894 fps=149 q=1.0 size= 14667kB time=00:00:35.80 bitrate=3356.1kbits/sframe= 981 fps=151 q=1.0 size= 15970kB time=00:00:39.28 bitrate=3330.6kbits/sframe= 1072 fps=153 q=1.0 size= 17080kB time=00:00:42.92 bitrate=3259.9kbits/sframe= 1154 fps=153 q=1.0 size= 18341kB time=00:00:46.20 bitrate=3252.2kbits/sframe= 1228 fps=153 q=1.0 size= 19483kB time=00:00:49.16 bitrate=3246.6kbits/sframe= 1310 fps=154 q=1.0 size= 20778kB time=00:00:52.44 bitrate=3245.9kbits/sframe= 1398 fps=155 q=1.0 size= 22162kB time=00:00:55.96 bitrate=3244.3kbits/sframe= 1481 fps=155 q=1.0 size= 23711kB time=00:00:59.28 bitrate=3276.7kbits/sframe= 1560 fps=156 q=1.0 size= 25418kB time=00:01:02.44 bitrate=3334.8kbits/sframe= 1640 fps=156 q=1.0 size= 27078kB time=00:01:05.64 bitrate=3379.4kbits/sframe= 1723 fps=156 q=1.0 size= 28696kB time=00:01:08.96 bitrate=3408.9kbits/sframe= 1805 fps=156 q=1.0 size= 30145kB time=00:01:12.24 bitrate=3418.5kbits/sframe= 1896 fps=158 q=1.0 size= 31242kB time=00:01:15.88 bitrate=3372.8kbits/sframe= 1976 fps=158 q=1.0 size= 32664kB time=00:01:19.08 bitrate=3383.7kbits/sframe= 2042 fps=157 q=1.0 size= 34108kB time=00:01:21.72 bitrate=3419.1kbits/sframe= 2111 fps=156 q=1.0 size= 35313kB time=00:01:24.48 bitrate=3424.3kbits/sframe= 2193 fps=156 q=1.0 size= 36785kB time=00:01:27.76 bitrate=3433.7kbits/sframe= 2263 fps=156 q=1.0 size= 38004kB time=00:01:30.56 bitrate=3437.8kbits/sframe= 2333 fps=155 q=1.0 size= 39097kB time=00:01:33.36 bitrate=3430.7kbits/sframe= 2407 fps=155 q=1.0 size= 40212kB time=00:01:36.32 bitrate=3420.0kbits/sframe= 2480 fps=155 q=1.0 size= 41414kB time=00:01:39.24 bitrate=3418.6kbits/sframe= 2552 fps=154 q=1.0 size= 42702kB time=00:01:42.12 bitrate=3425.5kbits/sframe= 2615 fps=153 q=1.0 size= 43509kB time=00:01:44.64 bitrate=3406.2kbits/sframe= 2674 fps=152 q=1.0 size= 44482kB time=00:01:47.00 bitrate=3405.6kbits/sframe= 2724 fps=151 q=1.0 size= 45356kB time=00:01:49.00 bitrate=3408.8kbits/sframe= 2784 fps=150 q=1.0 size= 46560kB time=00:01:51.40 bitrate=3423.8kbits/sframe= 2848 fps=149 q=1.0 size= 47857kB time=00:01:53.96 bitrate=3440.2kbits/sframe= 2912 fps=149 q=1.0 size= 49173kB time=00:01:56.52 bitrate=3457.2kbits/sframe= 2972 fps=148 q=1.0 size= 50434kB time=00:01:58.92 bitrate=3474.3kbits/sframe= 3033 fps=147 q=1.0 size= 51545kB time=00:02:01.36 bitrate=3479.4kbits/sframe= 3101 fps=147 q=1.0 size= 52729kB time=00:02:04.08 bitrate=3481.3kbits/sframe= 3184 fps=148 q=1.0 size= 54209kB time=00:02:07.40 bitrate=3485.7kbits/sframe= 3260 fps=148 q=1.0 Lsize= 55572kB time=00:02:10.45 bitrate=3489.6kbits/s
video:54423kB audio:1019kB subtitle:0 global headers:0kB muxing overhead 0.233212%
share|improve this question

migrated from stackoverflow.com Dec 20 '12 at 5:25

This question came from our site for professional and enthusiast programmers.

2  
Thank you. I fixed your formatting and included the code here, on-site. You can check the source to see how the formatting works. –  slhck Jan 4 '13 at 10:14
add comment

1 Answer

Do not use -sameq. It does not mean same quality, will probably make a huge output file (hence the long load time), and was removed recently from FFmpeg.

The video in the m4v container is probably H.264 which the FLV container can easily handle, so consider simply copying the video instead of re-encoding it:

ffmpeg -i input.m4v -vcodec copy -acodec libmp3lame -aq 4 -ar 44100 output.flv

If you want to re-encode to make a smaller output file than the input file then see the FFmpeg and x264 Encoding Guide. Use two-pass if you are targeting a specific output file size. Otherwise use CRF. All of this is explained in the guide.

If your version of FFmpeg does not have a libmp3lame encoder, you should download a recent Git snapshot and compile it yourself (see the Ubuntu and CentOS compilation guides), or get a static build from the FFmpeg download page.

share|improve this answer
    
We're discussing on chat if you're interested: chat.stackexchange.com/rooms/6957/… –  slhck Jan 4 '13 at 11:28
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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