Enabled Video, Video UI, Video Presets, VideoJS modules.

Selected FFmpeg in transcoders tab in Video Settings. Pressed save

I get the message:

FFmpeg 0.7.2 found on your system.

But I also get the error:

Notice: Undefined offset: 2 in PHPVideoToolkit->getFFmpegInfo() (line 611 of /sites/all/modules/video/libraries/phpvideotoolkit/phpvideotoolkit.php5.php).
Notice: Undefined offset: 1 in PHPVideoToolkit->getFFmpegInfo() (line 626 of /sites/all/modules/video/libraries/phpvideotoolkit/phpvideotoolkit.php5.php).
Notice: Undefined offset: 3 in PHPVideoToolkit->getFFmpegInfo() (line 641 of /sites/all/modules/video/libraries/phpvideotoolkit/phpvideotoolkit.php5.php)

Attached screenshot.

Comments

gumdrop’s picture

Same thing I am getting. Have you also installed the Video Presets mod? Because I am not getting any of the Video or audio codecs outputs showing up as well.
My "FFmpeg version 19215 found".

hypertext200’s picture

Category: bug » support
Status: Active » Fixed

Undefined offset: in PHPVideoToolkit->getFFmpegInfo()

has been fixed.

Have you also installed the Video Presets mod?

you need to install the video preset module for video conversions.

anglo’s picture

StatusFileSize
new125.35 KB

Yes. Video presets installed. Attached screenshot.

gumdrop’s picture

StatusFileSize
new71.4 KB

I've got the same issue.
@anglo do you see the Video codes? or are the drop down boxes empty. Mine are empty.

anglo’s picture

Status: Needs review » Fixed

@gumdrop, Drop down boxes are empty.
@heshan.lk, Where could the updated files be downloaded?

gumdrop’s picture

Status: Fixed » Needs review

@anglo apparently they are not supposed to be empty.

hypertext200’s picture

Status: Fixed » Active
clbeam’s picture

I had empty drop down boxes at one time. Drupal ffmpeg pull these from your version info of ffmpeg.
I found that I had to clear all caches after loading or working with ffmpeg. You must supply absolute paths to ffmpeg and flvtools, clear caches, check drupal status for correct ffmpeg version, then the drop downs will populate.

anglo’s picture

@clbeam. Cleared all caches several times. Drupal status shows the right ffmpeg version. Drop downs still don't populate.

gumdrop’s picture

@clbeam likewise as @anglo cleared all caches many many times. Drupal status shows the right ffmpeg version.
Including three "Notice: Undefined offset: 2 in PHPVideoToolkit->getFFmpegInfo() (line 611, 626, 641..."

Drop downs still don't populate.

Lazarus-Long’s picture

The problem is on line 594 in video/libraries/phpvideotoolkit/phpvideotoolkit.php5.php. 'configuration' should come before 'formats' in the $look_ups array. Works correctly after they're reversed.

gumdrop’s picture

Status: Active » Needs review

@Lazarus-Long Thank-you! That worked.

anglo’s picture

StatusFileSize
new986 bytes

@Lazarus-Long. That worked. Here's a patch.

Anonymous’s picture

@Lazarus-Long worked here also.

(problem was also present in 7.x-2.3)

starapple’s picture

Version: 7.x-2.2 » 7.x-2.3
Category: support » bug
Priority: Normal » Critical

Hi, since I'm on a shared host (GoDaddy, I doubt that FFmpeg is configured for transcoding video. When I set FFmpeg as the transcoder, I get a message "FFmpeg found on your system" and there's a path to the executable. However, I get the following notice:

Notice: Undefined offset: 0 in PHPVideoToolkit->getFFmpegInfo() (line 578 of /html/sites/all/modules/video/libraries/phpvideotoolkit/phpvideotoolkit.php5.php).
Notice: Undefined offset: 0 in PHPVideoToolkit->getFFmpegInfo() (line 578 of /html/sites/all/modules/video/libraries/phpvideotoolkit/phpvideotoolkit.php5.php).
Notice: Undefined index: formats in PHPVideoToolkit->getFFmpegInfo() (line 626 of /html/sites/all/modules/video/libraries/phpvideotoolkit/phpvideotoolkit.php5.php).
Notice: Undefined index: in PHPVideoToolkit->getFFmpegInfo() (line 626 of /html/sites/all/modules/video/libraries/phpvideotoolkit/phpvideotoolkit.php5.php).
Notice: Undefined index: codecs in PHPVideoToolkit->getFFmpegInfo() (line 641 of /html/sites/all/modules/video/libraries/phpvideotoolkit/phpvideotoolkit.php5.php).
Notice: Undefined index: in PHPVideoToolkit->getFFmpegInfo() (line 641 of /html/sites/all/modules/video/libraries/phpvideotoolkit/phpvideotoolkit.php5.php).

I'm using version 7.x-2.3 and I'm wondering if I'm missing something.

Thanks.

gumdrop’s picture

@starapple did you apply the patch in #13 or the solution in #11?

starapple’s picture

@gumdrop the presets list shows fine in my installation as the Video Presets module is installed and enabled. I think that's what #11/13 patch tried to fix. Maybe it's just that the server doesn't allow access to FFmpeg. Thanks.

Lazarus-Long’s picture

@starapple your problem is with the way phpvideotoolkit detects ffmpeg. You don't have access to ffmpeg on that system.

You can confirm it by making a short PHP script:

exec('ffmpeg -formats', $buffer);
var_dump($buffer);

For the discovery to fail, $buffer needs to contain "command not found" or "No such file or directory". Anything else will show FFmpeg as detected (even "Permission denied").

Also, this isn't related to the bug in this issue.

hypertext200’s picture

Status: Needs review » Closed (fixed)
hypertext200’s picture

Status: Closed (fixed) » Needs review
hypertext200’s picture

infines’s picture

valencianok’s picture

Version: 7.x-2.3 » 7.x-2.4
StatusFileSize
new5.3 KB

Hi

@Lazarus-Long I applied your patch, but still was getting some errors, so I changed the code on the lookups. Take a look at it, it worked for me.

naeluh’s picture

does this work for 7.x-2.4
thanks!!

themaurice’s picture

Warning: exec() has been disabled for security reasons in PHPVideoToolkit->_captureExecBuffer() (line 520 of /home/www/xxxxxx/sites/all/modules/video/libraries/phpvideotoolkit/phpvideotoolkit.php5.php).

Warning: fopen(/tmp/_temp_1328288131-4f2c1183bbad8.txt) [function.fopen]: failed to open stream: Operation not permitted in PHPVideoToolkit->_captureExecBuffer() (line 521 of /home/www/xxxxxx/sites/all/modules/video/libraries/phpvideotoolkit/phpvideotoolkit.php5.php).

Warning: implode() [function.implode]: Invalid arguments passed in PHPVideoToolkit->getFFmpegInfo() (line 584 of /home/www/xxxxxxx/sites/all/modules/video/libraries/phpvideotoolkit/phpvideotoolkit.php5.php).

Same error, I have ffmpeg already install in my server, I check with info.php, but Drupal won't recognize the ffmpeg. The URL of the absolute path is seem to be good too : /usr/bin/ffmpeg and it's possible to execute an .exe

Any advises to solve that would be good.

themaurice’s picture

Priority: Critical » Minor
Status: Needs review » Fixed

I simply solve this by comment the following line in php.ini

; disable_functions = show_source, system, shell_exec, passthru, exec, popen, proc_open

Hope this help.

bulldozer2003’s picture

Version: 7.x-2.4 » 7.x-2.x-dev
Component: Video Transcoding » User interface
Priority: Minor » Normal
Status: Fixed » Active

Please stop hijacking this thread with unrelated issues!

As of today, the undefined offset error is still present in 7.x-2.x-dev. Accompanied by the error, the video output extension, video codec, and audio codec fields are unpopulated.

Applying the patch in #13 fixes the error and causes the fields to populate.

The patch in #25 fails to apply.

Please put the patch from #13 into dev.

gagarine’s picture

Status: Active » Needs work

#3 doesn't solve the problem for me.

#25 The patch format is not good. Please use git to make your patch.

Jorrit’s picture

Please retest this issue on the latest 7.x-2.x-dev release, as I have made some changes. Please also reroll the patch(es) if they are still needed.

Jorrit’s picture

Status: Needs work » Postponed (maintainer needs more info)
leewillis77’s picture

StatusFileSize
new986 bytes

The attached patch is still required for me to avoid the PHP warnings, and have anything populated in the codec boxes against the prefixes, as per comment #13.

This is on a fresh install of Pressflow 7 with video from git (7.x-2.x branch), video_presets (7.x-2.x-dev).

$ffmpeg -version
ffmpeg version 0.7.3-4:0.7.3-0ubuntu0.11.10.1, Copyright (c) 2000-2011 the Libav developers

Jorrit’s picture

leewilis77: Could you post the exact error messages / warnings you get when you do not have the patch?

Also, could you post the output of ffmpeg -formats? It should not be needed to move the configuration part of the array because every ffmpeg output starts with a list of the configuration settings.

leewillis77’s picture

StatusFileSize
new12.59 KB
new7.51 KB

I see the following when I visit the transcoder config page, which line numbers aside appears to be the same issue originally reported

Notice: Undefined offset: 2 in PHPVideoToolkit->getFFmpegInfo() (line 612 of /home/webserver/videodebug/sites/all/modules/video/libraries/phpvideotoolkit/phpvideotoolkit.php5.php).
Notice: Undefined offset: 1 in PHPVideoToolkit->getFFmpegInfo() (line 627 of /home/webserver/videodebug/sites/all/modules/video/libraries/phpvideotoolkit/phpvideotoolkit.php5.php).
Notice: Undefined offset: 3 in PHPVideoToolkit->getFFmpegInfo() (line 642 of /home/webserver/videodebug/sites/all/modules/video/libraries/phpvideotoolkit/phpvideotoolkit.php5.php).

I've attached the output of ffmpeg -formats with, and without STDERR included, e.g.
$ ffmpeg -formats > /tmp/ffmpeg_formats.txt
$ ffmpeg -formats > /tmp/ffmpeg_formats_with_stderr.txt 2>&1

Jorrit’s picture

I'm sorry that I have to ask another thing, but can you post the output of:

ffmpeg -codecs 2>&1
ffmpeg -bsfs 2>&1
ffmpeg -protocols 2>&1

leewillis77’s picture

StatusFileSize
new5.23 KB
new5.24 KB
new19.3 KB

Attached.

Jorrit’s picture

Status: Postponed (maintainer needs more info) » Fixed

I have tried to investigate this issue, but after looking for a long time my conclusion is that the regular expression evaluator is confused because of the many "configure: " texts. I have committed the patch because it seems to work around the issue. The patch will be visible in the next 7.x-2.x-dev release, which gets built in the next 24 hours.

balornt’s picture

StatusFileSize
new19.33 KB

alrighty I'm having the same issue as the first post. I have the 7.x-2.x-dev from Mar-18. On line 619 of phpvideotoolkit.php5.php it reads:

preg_match('/' . implode('(.*)', $pregs) . '(.*)/s', $buffer, $matches);

I have confirmed that $matches is empty after this statement. I have the windows version 0.8 of ffmpeg. The regex that is created is this:

/configuration: (.*)File formats:(.*)Codecs:(.*)Bitstream filters:(.*)Supported file protocols:(.*)/s

The output of var_dump($buffers) is included. It would seem that in my case, "File Formats" comes before "configuration" contrary to the changes made in posts #11 and #13. Is there a specific version of FFmpeg that you recommend I use? If not should I just reverse the order of the $look_ups array?

Jorrit’s picture

The configuration part should be included in every part of the buffer. What is the output of ffmpeg -formats for you?

balornt’s picture

It was long so I will attach it to my next post

balornt’s picture

StatusFileSize
new8.49 KB

Here you go

balornt’s picture

It does appear to have my configuration in my buffer but after the File Formats section. This seems to be why the regex isn't matching.

Jorrit’s picture

Well, if I look in your formats.txt, there is a configuration section before the File formats: section. I wonder why it is not showing up in your $buffer.

balornt’s picture

Sigh. I think it is showing up in my buffer just after the File formats section. I compared it to the output of ffmpeg -formats and it seems to match. Any reason that it would appear after the File formats section? Perhaps because of the change made in post #11

Jorrit’s picture

You formats.txt says:

C:\xampp\htdocs\drupal\sites\all\libraries\ffmpeg\bin>ffmpeg -formats
ffmpeg version 0.8, Copyright (c) 2000-2011 the FFmpeg developers
built on Jun 23 2011 14:21:12 with gcc 4.5.3
configuration: --enable-gpl --enable-version3 --enable-memalign-hack --enable-
runtime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libo
pencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --
enable-libmp3lame --enable-libopenjpeg --enable-librtmp --enable-libschroedinger
--enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enabl
e-libx264 --enable-libxavs --enable-libxvid --enable-zlib
libavutil 51. 9. 1 / 51. 9. 1
libavcodec 53. 7. 0 / 53. 7. 0
libavformat 53. 4. 0 / 53. 4. 0
libavdevice 53. 1. 1 / 53. 1. 1
libavfilter 2. 23. 0 / 2. 23. 0
libswscale 2. 0. 0 / 2. 0. 0
libpostproc 51. 2. 0 / 51. 2. 0
File formats:
D. = Demuxing supported
.E = Muxing supported

balornt’s picture

I can't say for sure why but line 524 reads:

exec($command . ' 2>&1', $buffer, $err);

and it is initializing buffer to the contents above when line 585 is called:

$buffer = self::_captureExecBuffer($this->_ffmpeg_binary . ' -formats', $tmp_dir);

Something strange about php's exec function is causing the configuration section to appear after the File Formats section with my version of PHP (5.3.8). I will continue with my modified version of the Video Module code.

Many of the errors in this section may be related to the PHP and/or FFmpeg versions being used. If that is the case I would post recommended versions in the Module description.

balornt’s picture

i was talking about $buffer from the code it reads:

string(26078) "File formats: D. = Demuxing supported .E = Muxing supported -- E 3g2 3GP2 format E 3gp 3GP format D 4xm 4X Technologies format D IFF IFF format D ISS Funcom ISS format D MTV MTV format DE RoQ raw id RoQ format E a64 a64 - video for Commodore 64 D aac raw ADTS AAC DE ac3 raw AC-3 E adts ADTS AAC D aea MD STUDIO audio DE aiff Audio IFF DE alaw PCM A-law format DE amr 3GPP AMR file format D anm Deluxe Paint Animation D apc CRYO APC format D ape Monkey's Audio D applehttp Apple HTTP Live Streaming format DE asf ASF format E asf_stream ASF format DE ass Advanced SubStation Alpha subtitle format DE au SUN AU format DE avi AVI format E avm2 Flash 9 (AVM2) format D avs AVISynth D bethsoftvid Bethesda Softworks VID format D bfi Brute Force & Ignorance D bink Bink D c93 Interplay C93 DE caf Apple Core Audio Format DE cavsvideo raw Chinese AVS video D cdg CD Graphics Format E crc CRC testing format DE daud D-Cinema audio format D dfa Chronomaster DFA DE dirac raw Dirac DE dnxhd raw DNxHD (SMPTE VC-3) D dshow DirectShow capture D dsicin Delphine Software International CIN format DE dts raw DTS DE dv DV video format E dvd MPEG-2 PS format (DVD VOB) D dxa DXA D ea Electronic Arts Multimedia Format D ea_cdata Electronic Arts cdata DE eac3 raw E-AC-3 DE f32be PCM 32 bit floating-point big-endian format DE f32le PCM 32 bit floating-point little-endian format DE f64be PCM 64 bit floating-point big-endian format DE f64le PCM 64 bit floating-point little-endian format DE ffm FFM (FFserver live feed) format DE ffmetadata FFmpeg metadata in text format D film_cpk Sega FILM/CPK format DE filmstrip Adobe Filmstrip DE flac raw FLAC D flic FLI/FLC/FLX animation format DE flv FLV format E framecrc framecrc testing format E framemd5 Per-frame MD5 testing format DE g722 raw G.722 E gif GIF Animation D gsm raw GSM DE gxf GXF format DE h261 raw H.261 DE h263 raw H.263 DE h264 raw H.264 video format D idcin id Cinematic format DE image2 image2 sequence DE image2pipe piped image2 sequence D ingenient raw Ingenient MJPEG D ipmovie Interplay MVE format E ipod iPod H.264 MP4 format D iv8 A format generated by IndigoVision 8000 video server DE ivf On2 IVF D jv Bitmap Brothers JV D lmlm4 lmlm4 raw format D lxf VR native stream format (LXF) DE m4v raw MPEG-4 video format E matroska Matroska file format D matroska,webm Matroska/WebM file format E md5 MD5 testing format DE microdvd MicroDVD subtitle format DE mjpeg raw MJPEG video DE mlp raw MLP D mm American Laser Games MM format DE mmf Yamaha SMAF E mov MOV format D mov,mp4,m4a,3gp,3g2,mj2 QuickTime/MPEG-4/Motion JPEG 2000 format E mp2 MPEG audio layer 2 DE mp3 MPEG audio layer 3 E mp4 MP4 format D mpc Musepack D mpc8 Musepack SV8 DE mpeg MPEG-1 System format E mpeg1video raw MPEG-1 video E mpeg2video raw MPEG-2 video DE mpegts MPEG-2 transport stream format D mpegtsraw MPEG-2 raw transport stream format D mpegvideo raw MPEG video E mpjpeg MIME multipart JPEG format D msnwctcp MSN TCP Webcam stream DE mulaw PCM mu-law format D mvi Motion Pixels MVI format DE mxf Material eXchange Format E mxf_d10 Material eXchange Format, D-10 Mapping D mxg MxPEG clip file format D nc NC camera feed format D nsv Nullsoft Streaming Video E null raw null video format DE nut NUT format D nuv NuppelVideo format DE ogg Ogg D oma Sony OpenMG audio D pmp Playstation Portable PMP format E psp PSP MP4 format D psxstr Sony Playstation STR format D pva TechnoTrend PVA file and stream format D qcp QCP format D r3d REDCODE R3D format DE rawvideo raw video format E rcv VC-1 test bitstream D rl2 RL2 format DE rm RealMedia format D rpl RPL/ARMovie format DE rso Lego Mindstorms RSO format DE rtp RTP output format DE rtsp RTSP output format DE s16be PCM signed 16 bit big-endian format DE s16le PCM signed 16 bit little-endian format DE s24be PCM signed 24 bit big-endian format DE s24le PCM signed 24 bit little-endian format DE s32be PCM signed 32 bit big-endian format DE s32le PCM signed 32 bit little-endian format DE s8 PCM signed 8 bit format DE sap SAP output format E sdl SDL output device D sdp SDP D shn raw Shorten D siff Beam Software SIFF D smk Smacker video D sol Sierra SOL format DE sox SoX native format DE spdif IEC 61937 (used on S/PDIF - IEC958) DE srt SubRip subtitle format E svcd MPEG-2 PS format (VOB) DE swf Flash format D thp THP D tiertexseq Tiertex Limited SEQ format D tmv 8088flex TMV DE truehd raw TrueHD D tta True Audio D tty Tele-typewriter D txd Renderware TeXture Dictionary DE u16be PCM unsigned 16 bit big-endian format DE u16le PCM unsigned 16 bit little-endian format DE u24be PCM unsigned 24 bit big-endian format DE u24le PCM unsigned 24 bit little-endian format DE u32be PCM unsigned 32 bit big-endian format DE u32le PCM unsigned 32 bit little-endian format DE u8 PCM unsigned 8 bit format D vc1 raw VC-1 D vc1test VC-1 test bitstream format E vcd MPEG-1 System format (VCD) D vfwcap VFW video capture D vmd Sierra VMD format E vob MPEG-2 PS format (VOB) DE voc Creative Voice file format D vqf Nippon Telegraph and Telephone Corporation (NTT) TwinVQ D w64 Sony Wave64 format DE wav WAV format D wc3movie Wing Commander III movie format E webm WebM file format D wsaud Westwood Studios audio format D wsvqa Westwood Studios VQA format D wtv Windows Television (WTV) D wv WavPack D xa Maxis XA File Format D xwma Microsoft xWMA D yop Psygnosis YOP Format DE yuv4mpegpipe YUV4MPEG pipe format ffmpeg version 0.8, Copyright (c) 2000-2011 the FFmpeg developers built on Jun 23 2011 14:21:12 with gcc 4.5.3 configuration: --enable-gpl --enable-version3 --enable-memalign-hack --enable-runtime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib libavutil 51. 9. 1 / 51. 9. 1 libavcodec 53. 7. 0 / 53. 7. 0 libavformat 53. 4. 0 / 53. 4. 0 libavdevice 53. 1. 1 / 53. 1. 1 libavfilter 2. 23. 0 / 2. 23. 0 libswscale 2. 0. 0 / 2. 0. 0 libpostproc 51. 2. 0 / 51. 2. 0
...

and since the Regex is being run on this, it doesn't match when it looks for configuration first

Jorrit’s picture

StatusFileSize
new155.26 KB

I have refactored the entire method to get rid of the regular expression. I have attached a replacement file to this comment.

Could you:

1) Replace the file libraries/phpvideotoolkit/phpvideotoolkit.php5.php with the attached file
2) Clear the Drupal cache
3) See if the errors are gone
4) And if everything is still working properly

balornt’s picture

Looks good to me.

Jorrit’s picture

leewillis77: does the attached file from comment #49 also work for you?

Jorrit’s picture

Status: Fixed » Postponed (maintainer needs more info)
balornt’s picture

It does work. Forgive my ambiguity.

leewillis77’s picture

Hi Jorrit,

I can't test this unfortunately as both machines that exhibited this problem have been upgraded and no longer exhibit the problem - which was presumably specific to the version in use originally.

Jorrit’s picture

What do you mean by "upgraded"? If you mean "upgraded to the latest 7.x-2.x-dev version", my request to you is if you could still try the attached version of phpvideotoolkit.php5.php on top of the already working -dev version.

leewillis77’s picture

Ah - no - sorry. The machines have been upgraded from Ubuntu 11.10 to Ubuntu 12.04.

The version supplied on Ubuntu 12.04 (Which is actually a compatibility app provided by libav rather than a "real" copy of ffmpeg), appears to work without any patches necessary.

I'm happy to apply the patch and check it *still* works, but I'm not sure if that would prove that the patch solves the problem?

Jorrit’s picture

Well, it would prove that it also works in environments other than mine and balornt's. When it comes to ffmpeg, I have discovered that there can be many, many different environments. So if you could test the changed file, that would be very much appreciated!

leewillis77’s picture

The file attached in #49 seems to work fine for me.

kedia.us’s picture

Using the patch in #49 and "upgrading" to the development version does work.

Jorrit’s picture

Status: Postponed (maintainer needs more info) » Fixed

balornt, leewillis77, corporate: thanks for testing.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.