ffmpeg-transcoded H.264 video does not play in Chrome

3

I am trying to transcode videos using ffmpeg. Following is the sample command.

ffmpeg.exe -i 534.mp4 -vcodec libx264  -level 3.1 -b:v 396k -ar 48000 -ab 32k -s 100x100  -force_key_frames expr:gte(t,n_forced*2) -y -r 29.97 output.mp4

This plays well in IE and Firefox but not on Chrome. What could be the issue? How do I set different presets? When I give -vpre, it errors out mentioning "File for preset not found".

Here is the console output:

ffmpeg version N-65738-g3c197442 Copyright (c) 2000-2014 the FFmpeg developers
  built on Aug 18 2014 22:10:31 with gcc 4.8.3 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfi
g --enable-frei0r --enable-gnutls --enable-iconv --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --
enable-libfreetype --enable-libgme --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --enable-lib
opencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinge
r --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvo-aacenc --
enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-
libx265 --enable-libxavs --enable-libxvid --enable-decklink --enable-zlib
  libavutil      54.  5.100 / 54.  5.100
  libavcodec     56.  0.101 / 56.  0.101
  libavformat    56.  1.100 / 56.  1.100
  libavdevice    56.  0.100 / 56.  0.100
  libavfilter     5.  0.100 /  5.  0.100
  libswscale      3.  0.100 /  3.  0.100
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  0.100 / 53.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '534.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isom
    creation_time   : 2014-09-26 19:08:24
  Duration: 00:02:04.33, start: 0.000000, bitrate: 107 kb/s
    Stream #0:0(eng): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p(tv), 192x128 [SAR 1:1 DAR 3:2], 75 kb/s, 12.50
 fps, 12.50 tbr, 12500 tbn, 25 tbc (default)
    Metadata:
      creation_time   : 2014-09-26 19:08:24
      handler_name    : MP4 Video Media Handler
      encoder         : AVC Coding
    Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 30 kb/s (default)
    Metadata:
      creation_time   : 2014-09-26 19:08:24
      handler_name    : MP4 Sound Media Handler
[libx264 @ 0000000002ac5920] using SAR=3/2
[libx264 @ 0000000002ac5920] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
[libx264 @ 0000000002ac5920] profile High, level 3.1
[libx264 @ 0000000002ac5920] 264 - core 142 r2453 ea0ca51 - H.264/MPEG-4 AVC codec - Copyleft 2003-2014 - http://www.vid
eolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed
_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookah
ead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_
adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahe
ad=40 rc=abr mbtree=1 bitrate=396 ratetol=1.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'output.mp4':
  Metadata:
    major_brand     : mp42
    minor_version   : 0
    compatible_brands: isom
    encoder         : Lavf56.1.100
    Stream #0:0(eng): Video: h264 (libx264) ([33][0][0][0] / 0x0021), yuv420p, 100x100 [SAR 3:2 DAR 3:2], q=-1--1, 396 k
b/s, 29.97 fps, 11988 tbn, 29.97 tbc (default)
    Metadata:
      creation_time   : 2014-09-26 19:08:24
      handler_name    : MP4 Video Media Handler
      encoder         : Lavc56.0.101 libx264
    Stream #0:1(eng): Audio: aac (libvo_aacenc) ([64][0][0][0] / 0x0040), 48000 Hz, stereo, s16, 32 kb/s (default)
    Metadata:
      creation_time   : 2014-09-26 19:08:24
      handler_name    : MP4 Sound Media Handler
      encoder         : Lavc56.0.101 libvo_aacenc
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
  Stream #0:1 -> #0:1 (aac (native) -> aac (libvo_aacenc))
Press [q] to stop, [?] for help
frame= 3722 fps=847 q=-1.0 Lsize=    5702kB time=00:02:04.34 bitrate= 375.7kbits/s dup=2169 drop=0
video:5083kB audio:487kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 2.378099%
[libx264 @ 0000000002ac5920] frame I:71    Avg QP: 0.46  size:  6755
[libx264 @ 0000000002ac5920] frame P:1542  Avg QP: 0.52  size:  2867
[libx264 @ 0000000002ac5920] frame B:2109  Avg QP: 3.55  size:   144
[libx264 @ 0000000002ac5920] consecutive B-frames: 14.2% 28.2%  7.7% 50.0%
[libx264 @ 0000000002ac5920] mb I  I16..4: 25.2%  5.1% 69.7%
[libx264 @ 0000000002ac5920] mb P  I16..4:  2.1%  0.5%  4.6%  P16..4: 26.3% 12.5% 11.2%  0.0%  0.0%    skip:42.8%
[libx264 @ 0000000002ac5920] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8: 10.9%  1.1%  0.6%  direct: 1.9%  skip:85.5%  L0:41
.7% L1:51.9% BI: 6.5%
[libx264 @ 0000000002ac5920] final ratefactor: -7.35
[libx264 @ 0000000002ac5920] 8x8 transform intra:6.1% inter:21.2%
[libx264 @ 0000000002ac5920] coded y,uvDC,uvAC intra: 65.5% 80.0% 79.4% inter: 18.5% 21.3% 21.2%
[libx264 @ 0000000002ac5920] i16 v,h,dc,p: 44% 50%  4%  1%
[libx264 @ 0000000002ac5920] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 26% 39% 16%  3%  2%  3%  3%  4%  5%
[libx264 @ 0000000002ac5920] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 14% 51% 10%  3%  4%  4%  4%  4%  6%
[libx264 @ 0000000002ac5920] i8c dc,h,v,p: 27% 54% 15%  4%
[libx264 @ 0000000002ac5920] Weighted P-Frames: Y:4.9% UV:2.4%
[libx264 @ 0000000002ac5920] ref P L0: 78.8% 10.4%  6.6%  4.0%  0.2%
[libx264 @ 0000000002ac5920] ref B L0: 96.9%  2.4%  0.7%
[libx264 @ 0000000002ac5920] ref B L1: 99.8%  0.2%
[libx264 @ 0000000002ac5920] kb/s:335.24

jagadeesh

Posted 2014-10-01T05:56:26.000

Reputation: 31

Please include the full, uncut command line output. Note that presets should not be used anymore. – slhck – 2014-10-01T06:06:53.303

can you please let me know what should be used instead? @slhck. I updated the question with the complete output. – jagadeesh – 2014-10-01T21:45:27.740

I don't see anything obviously wrong here. Can you add a sample video? Regarding the presets.. it depends on what you need to achieve with these videos. Where are they going to be used? The 100x100 size seems a little odd to me. – slhck – 2014-10-02T07:36:54.040

Answers

3

identified the reason behind this. its with the way ffmpeg puts the metadata. other browsers were able to successfully download the file and play it where as chrome was not. once I ran the tool qt-faststart, the chrome also started playing and downloading in parallel.

jagadeesh

Posted 2014-10-01T05:56:26.000

Reputation: 31

2You could use -movflags +faststart as an output option instead of the separate qt-faststart tool. – llogan – 2014-10-03T18:28:58.297

@LordNeckbeard You should maybe make this as an answer, because that completely solved my problem which I am trying to solve for hours. – Luca Steeb – 2017-01-04T13:55:18.173

2

Use -movflags +faststart as an output option:

ffmpeg -i input.mp4 -c copy -movflags +faststart output.mp4

It will relocate some data to the beginning of the file facilitating playback during progressive download instead of having to wait for it to download completely.

llogan

Posted 2014-10-01T05:56:26.000

Reputation: 31 929

This saved my life. – Luca Steeb – 2017-01-04T19:52:57.803