4

This question may be asked in different forums but still answer is not discovered yet.

I am trying to play *.flv using Video Module and FFMPEG Converter. Whenever I upload any flv Video , I get the following message:-

PHPVideoToolkit error: Execute error. It was not possible to encode "C:\xampp\htdocs\Resonance\sites\default\files\videos\original\barsandtone_3.flv" as FFmpeg returned an error. The error is with the video codec of the input file. FFmpeg reports the error to be "Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height".

Installed Modules are:-

Video - 7.x-2.9

Video.js - 7.x-2.3 - Version: 4.0.3

Video transcoder: FFmpeg / avconv : git: c2dd5a1

JW Player

All above are installed correctly.

Configuration of Video Module:-

Inside Player Tab of Video(admin/config/media/video/players), following has been configured:-

enter image description here

A New FLV Preset has been created and added under Preset Tab of Video(admin/config/media/video/presets). Details are as Follows:-

Preset name :- FLV Preset

Video output extension :- FLV Flash Video

Video codec :- H 263/H263-1996,H263+/H263-1998/H263 Version 2(Not sure about Video Codec)

FFmpeg video preset :- None

Video quality :-None

Video speed :- None

Dimensions :- 640 X 360

Aspect mode :- Preserve Aspect Ratio

When I am uploading the video from content type then it extract the thumbnail as follows:-

enter image description here

After saving the video it shows the following Mesage:-

enter image description here

My gut feeling is that I am setting up wrong preset but I am not able to solve this problem out. Please help me as I am very close to my completion of project which would have been waste without solving the problem.

Updated:-

The Console message is as follows:-

Reported errors

PHPVideoToolkit error: Execute error. It was not possible to encode "C:\xampp\htdocs\Resonance\sites\default\files\videos\original\barsandtone_19.flv" as FFmpeg returned an error. Note, however the error was encountered on the second pass of the encoding process and the first pass appear to go fine. The error is with the video codec of the input file. FFmpeg reports the error to be "Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height".

Executed commands and output

/ffmpeg/ffmpeg.exe -i "C:\xampp\htdocs\Resonance\sites\default\files\videos\original\barsandtone_7.flv" -strict experimental -vcodec "h264" -s "320x180" -acodec "aac" -ac "2" -pass "1" -passlogfile "C:\xampp\tmp/1384191046-5281144682cfc-multipass"  -y C:\xampp\tmp/1384191046-5281144681e51.flv

ffmpeg version N-49610-gc2dd5a1 Copyright (c) 2000-2013 the FFmpeg developers
  built on Feb  5 2013 13:26:02 with gcc 4.7.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      52. 17.101 / 52. 17.101
  libavcodec     54. 91.100 / 54. 91.100
  libavformat    54. 61.104 / 54. 61.104
  libavdevice    54.  3.103 / 54.  3.103
  libavfilter     3. 35.101 /  3. 35.101
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
[flv @ 00000000002fb860] max_analyze_duration 5000000 reached at 5018000 microseconds
Input #0, flv, from 'C:\xampp\htdocs\Resonance\sites\default\files\videos\original\barsandtone_7.flv':
  Metadata:
    audiodelay      : 0
    canSeekToEnd    : true
  Duration: 00:00:06.00, start: 0.000000, bitrate: 118 kb/s
    Stream #0:0: Video: vp6f, yuv420p, 360x288, 409 kb/s, 1k tbr, 1k tbn, 1k tbc
    Stream #0:1: Audio: mp3, 44100 Hz, stereo, s16p, 96 kb/s
[libx264 @ 0000000002457340] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2
[libx264 @ 0000000002457340] profile Main, level 4.0
[libx264 @ 0000000002457340] 264 - core 129 r2245 bc13772 - H.264/MPEG-4 AVC codec - Copyleft 2003-2013 - http://www.videolan.org/x264.html - options: cabac=1 ref=1 deblock=1:0:0 analyse=0x1:0 me=dia subme=2 psy=1 psy_rd=1.00:0.00 mixed_ref=0 me_range=16 chroma_me=1 trellis=0 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=0 threads=6 lookahead_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_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, flv, to 'C:\xampp\tmp/1384191046-5281144681e51.flv':
  Metadata:
    audiodelay      : 0
    canSeekToEnd    : true
    encoder         : Lavf54.61.104
    Stream #0:0: Video: h264 ([7][0][0][0] / 0x0007), yuv420p, 320x180, q=-1--1, pass 1, 1k tbn, 1k tbc
    Stream #0:1: Audio: aac ([10][0][0][0] / 0x000A), 44100 Hz, stereo, fltp, 128 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (vp6f -> libx264)
  Stream #0:1 -> #0:1 (mp3 -> aac)
Press [q] to stop, [?] for help
frame=    2 fps=0.0 q=-1.0 Lsize=     102kB time=00:00:06.10 bitrate= 136.7kbits/s
video:2kB audio:95kB subtitle:0 global headers:0kB muxing overhead 4.978013%
[libx264 @ 0000000002457340] frame I:1     Avg QP:11.95  size:  1595
[libx264 @ 0000000002457340] frame P:1     Avg QP: 2.00  size:    21
[libx264 @ 0000000002457340] mb I  I16..4: 86.3%  0.0% 13.8%
[libx264 @ 0000000002457340] mb P  I16..4:  0.4%  0.0%  0.0%  P16..4:  0.0%  0.0%  0.0%  0.0%  0.0%    skip:99.6%
[libx264 @ 0000000002457340] coded y,uvDC,uvAC intra: 13.8% 40.7% 32.8% inter: 0.0% 0.0% 0.0%
[libx264 @ 0000000002457340] i16 v,h,dc,p: 80% 15%  4%  0%
[libx264 @ 0000000002457340] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 36% 42% 21%  0%  0%  0%  0%  0%  0%
[libx264 @ 0000000002457340] i8c dc,h,v,p: 45% 24% 31%  0%
[libx264 @ 0000000002457340] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0000000002457340] kb/s:1.08

/ffmpeg/ffmpeg.exe -i "C:\xampp\htdocs\Resonance\sites\default\files\videos\original\barsandtone_7.flv" -strict experimental -vcodec "h264" -s "320x180" -acodec "aac" -ac "2" -pass "2" -passlogfile "C:\xampp\tmp/1384191046-5281144682cfc-multipass"  -y C:\xampp\tmp/1384191046-5281144681e51.flv

ffmpeg version N-49610-gc2dd5a1 Copyright (c) 2000-2013 the FFmpeg developers
  built on Feb  5 2013 13:26:02 with gcc 4.7.2 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      52. 17.101 / 52. 17.101
  libavcodec     54. 91.100 / 54. 91.100
  libavformat    54. 61.104 / 54. 61.104
  libavdevice    54.  3.103 / 54.  3.103
  libavfilter     3. 35.101 /  3. 35.101
  libswscale      2.  2.100 /  2.  2.100
  libswresample   0. 17.102 /  0. 17.102
  libpostproc    52.  2.100 / 52.  2.100
[flv @ 00000000002fb860] max_analyze_duration 5000000 reached at 5018000 microseconds
Input #0, flv, from 'C:\xampp\htdocs\Resonance\sites\default\files\videos\original\barsandtone_7.flv':
  Metadata:
    audiodelay      : 0
    canSeekToEnd    : true
  Duration: 00:00:06.00, start: 0.000000, bitrate: 118 kb/s
    Stream #0:0: Video: vp6f, yuv420p, 360x288, 409 kb/s, 1k tbr, 1k tbn, 1k tbc
    Stream #0:1: Audio: mp3, 44100 Hz, stereo, s16p, 96 kb/s
[libx264 @ 00000000024e7340] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.2
[libx264 @ 00000000024e7340] constant rate-factor is incompatible with 2pass.
Output #0, flv, to 'C:\xampp\tmp/1384191046-5281144681e51.flv':
  Metadata:
    audiodelay      : 0
    canSeekToEnd    : true
    Stream #0:0: Video: h264, yuv420p, 320x180, q=-1--1, pass 2, 90k tbn, 1k tbc
    Stream #0:1: Audio: none, 44100 Hz, stereo, fltp, 128 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (vp6f -> libx264)
  Stream #0:1 -> #0:1 (mp3 -> aac)
Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height

I am not Unix Wizard to get the things out of this. Please help me in suggesting the right path.

simple user
  • 349
  • 3
  • 22
  • 44
  • You need to find out what the actual ffmpeg command is and the complete ffmpeg console output is required too. – llogan Nov 10 '13 at 21:34
  • Hi, I have updated the console message in the main question.Please help me in suggesting a solution. Currently My Video codec is H264/AVC/MPEG-4 AVC/MPEG-4 Part 10 – simple user Nov 11 '13 at 18:05

1 Answers1

1

What is wrong

Error while opening encoder for output stream #0:0 - maybe incorrect parameters
such as bit_rate, rate, width or height

This message is at the end of the console output. It indicates that there is a problem with output stream 0:0 which refers to "first input:first stream", so in this case 0:0 is your video stream.

[libx264 @ 00000000024e7340] constant rate-factor is incompatible with 2pass.

This is the important message. By default ffmpeg will use -crf if you do not declare a bitrate with -b:v, but crf mode is incompatible with 2 pass. ffmpeg can not always know what you want, so the defaults in some situations do not always work but it will usually tell you why.

Do you need two passes?

Do you need two passes? Two-passes is most often used if you are trying to target a specific output file size. If getting an exact output file size is not a concern then just do one pass and use crf instead:

ffmpeg -y -i input -vcodec libx264 -vf scale=320:-1 -crf 23 -preset medium \
-acodec copy output.flv
  • The encoder is generally named libx264 and decoder is usually called h264.
  • -y is a global option, so it goes before -i.
  • Since your input contains MP3 audio at an audio rate of 44100, and your output container (flv) can support this, then you can simply stream copy the audio with -acodec copy instead of re-encoding it.
  • Forcing 320x180 will probably vertically squish the output (I would expect 320x256). You can use the scale video filter instead of -s to automatically calculate the output size and preserve the aspect ratio.
  • See the FFmpeg and x264 Encoding Guide for details on -crf and -preset.

If you must re-encode audio

Using libmp3lame is probably better than the native, experimental encoder aac:

ffmpeg -y -i input -vcodec libx264 -vf scale=320:-1 -crf 23 -preset medium \
-acodec libmp3lame -ac 2 -ar 44100 -q:a 4 output.flv

Also see:

llogan
  • 121,796
  • 28
  • 232
  • 243