VideoJS and HTML5 and iPad

1,314 views
Skip to first unread message

Peter

unread,
May 3, 2012, 8:11:50 AM5/3/12
to resour...@googlegroups.com
Hello there,

FInally managed to install resourcespace. Had to do a complete reinstall of CentOS 6.2 from the ground up starting with a minimal installation and adding only the required stuff for resourcespace.

Everything is working fine now (as far as I have tested) except getting to see the site on iPads.

I read the whole stuff about VideoJS and how to install the plugin and activate it and edited the required strings in config.php having copied the majority of the stuff from config.default.php.

Now, the difficulties I am experiencing are as follows.

I changed the line:

$ffmpeg_preview_extension="flv";

so that the pertinent section reads:

$ffmpeg_preview=true;
$ffmpeg_preview_seconds=180; # how many seconds to preview
$ffmpeg_preview_extension="mp4";
$ffmpeg_preview_min_width=32;
$ffmpeg_preview_min_height=18;
$ffmpeg_preview_max_width=480;
$ffmpeg_preview_max_height=270;

And I have also tried several encoding commands for ffmpeg.

These settings were also included in config.php:

# Use qt-faststart to make mp4 previews start faster
$qtfaststart_path="/usr/bin";
$qtfaststart_extensions=array("mp4","m4v","mov");

But unfortunately the only way the resource is shown is as if it was a picture. RS will create the required thumbnails for it but no mp4 is created.  (I have gone into the filestore folders to created these mp4's via the comand line and they are viable video files ie. they can be viewed in vlc, qt on my windows desktop in prefect condition).

I have then tried several combinations of these config.php settings to see if at least the mp4 would be created but alas I had no success.

I have even put these lines in config.php:

$ffmpeg_alternatives[0]["filename"]="mp4";
$ffmpeg_alternatives[0]["name"]="mp4";
$ffmpeg_alternatives[0]["extension"]="mp4";
$ffmpeg_alternatives[0]["params"]=" -vpre libx264-ipod640 -acodec libfaac -ab 128k -ar 48000 -ac 1 -threads 0  -vf setsar=1 ";
$ffmpeg_alternatives[0]["lines_min"]=21;
$ffmpeg_alternatives[0]["alt_preview"]=true;

but the mp4 would not be created by the php code. Then I tried 

# To be able to run certain actions asyncronus (eg. preview transcoding), define the path to php:
$php_path="/usr/bin";

but no results with this either.

I am sure I am missing something in the middle but I do not know what.

Please help.

mrpatulski

unread,
May 3, 2012, 9:18:56 AM5/3/12
to resour...@googlegroups.com
Do you have the 264 libraries installed for FFmpeg

Peter Romão

unread,
May 3, 2012, 11:10:08 AM5/3/12
to resour...@googlegroups.com
I guess I have beause I installed ffmpeg as instructed in the web pages in the resourcespace wiki.
Anyway, here's the output of the ffmpeg command which shows that x264 is installed and as I mentioned in my previous post: the mp4 files were encoded from the AVCHD (*.mts) Canon file format without any sort of problems when done from the command line in a terminal window.

[root@centos62 ~]# ffmpeg
FFmpeg version 0.6.5, Copyright (c) 2000-2010 the FFmpeg developers
  built on Jan 29 2012 23:55:02 with gcc 4.1.2 20080704 (Red Hat 4.1.2-51)
  configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandi
r=/usr/share/man --incdir=/usr/include --disable-avisynth --extra-cflags='-O2 -g
 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-
buffer-size=4 -m64 -mtune=generic -fPIC' --enable-avfilter --enable-avfilter-lav
f --enable-libdirac --enable-libfaac --enable-libfaad --enable-libfaadbin --enab
le-libgsm --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-am
rwb --enable-libx264 --enable-gpl --enable-nonfree --enable-postproc --enable-pt
hreads --enable-shared --enable-swscale --enable-vdpau --enable-version3 --enabl
e-x11grab
  libavutil     50.15. 1 / 50.15. 1
  libavcodec    52.72. 2 / 52.72. 2
  libavformat   52.64. 2 / 52.64. 2
  libavdevice   52. 2. 0 / 52. 2. 0
  libavfilter    1.19. 0 /  1.19. 0
  libswscale     0.11. 0 /  0.11. 0
  libpostproc   51. 2. 0 / 51. 2. 0
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfi
le}...

Use -h to get full help or, even better, run 'man ffmpeg'
[root@centos62 ~]#

mrpatulski

unread,
May 3, 2012, 1:25:17 PM5/3/12
to resour...@googlegroups.com
OK, great. A few more questions:

[1] Are your files in a default video sizes ie 640 by 480, 854 by 480, 1270 by 720? x264 get finicky with non-standard sizes.
[2] Is your FFMPEG the most current version--may be a conflict there with newer x264 libraries?
[3] Your config example is missing this line--do you have something similar in your config file?

$ffmpeg_preview_options=" -threads 0 -acodec libfaac -strict experimental -vcodec libx264 -ab 64k ";

These also work pretty well:
-vf scale=640:-1 -b 1000k -bt 1400k -vcodec libx264 -vpre ipod640 -acodec libfaac -ac 2 -ab 160k -threads 0
-vf scale=480:-1 -b 400k -bt 480k -vcodec libx264 -preset slow -acodec libfaac -ac 2 -ab 160k -threads 0

Peter Romão

unread,
May 3, 2012, 8:10:58 PM5/3/12
to resour...@googlegroups.com
Hello and thanks for the heads up.

The files I am uploading are standard AVCHD sizes mostly

ID                                       : 4113 (0x1011)
Menu ID                                  : 1 (0x1)
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : High@L4.0
Format settings, CABAC                   : Yes
Format settings, ReFrames                : 2 frames
Format settings, GOP                     : M=3, N=12
Codec ID                                 : 27
Duration                                 : 5s 680ms
Bit rate mode                            : Variable
Bit rate                                 : 22.7 Mbps
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate                               : 25.000 fps
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Interlaced
Scan order                               : Top Field First
Bits/(Pixel*Frame)                       : 0.438
Stream size                              : 15.3 MiB (93%)

But I think you're referring to the ones I must encode to, right?

FFMPEG took care of this file correctly (as well as others in the same format) on the terminal command line.

Nevertheless I am going to recompile FFMPEG as per these steps on ffmpeg.org. I guess this ffmpeg will lack a couple of decoder encoders like xvid but I can always compile those back in.

.... time goes by ...

OK so now this is what I have now:

[root@medialib 2_5787814d029fca4]# ffmpeg
ffmpeg version N-40331-gd98b254 Copyright (c) 2000-2012 the FFmpeg developers
  built on May  4 2012 00:06:36 with gcc 4.4.6 20110731 (Red Hat 4.4.6-3)
  configuration: --enable-gpl --enable-libmp3lame --enable-libtheora --enable-li
bvo-aacenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-version3
  libavutil      51. 49.100 / 51. 49.100
  libavcodec     54. 19.100 / 54. 19.100
  libavformat    54.  4.100 / 54.  4.100
  libavdevice    53.  4.100 / 53.  4.100
  libavfilter     2. 72.104 /  2. 72.104
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0. 11.100 /  0. 11.100
  libpostproc    52.  0.100 / 52.  0.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfi
le}...

And lo and behold everything is working now!

The ffmpeg command I am using is 

$ffmpeg_preview_options=" -threads 0 -acodec libvo_aacenc -strict experimental -vcodec libx264 -ab 64KB";

I think this can definitely be improved and audio is horrible with this libvo-aacenc encoder. I must find a better one.

I will also have to test this with a firefox and PC Safari version as well as opera browsers.

Thanks for the great help mrpatuski, you led me to the right place. I guess ,y previous version of ffmpeg was not able to create the required mp4 files.

My question now is: shouldn't this VideoJS have created a flv file as well for fallback purposes?

Cheers
Peter

mrpatulski

unread,
May 3, 2012, 11:54:53 PM5/3/12
to resour...@googlegroups.com
Peter,
the thinking is a single  MP4 should play in both the default player or  an HTML5 player like video JS. No FLV needed as ong as you have flash 9+ in your desktop.
Make sense?

Peter Romão

unread,
May 7, 2012, 6:20:46 AM5/7/12
to resour...@googlegroups.com
Yeps it does, thanks for the clarification.

I still have some issues though. Up to this point ingestion of the following formats was done without a glitch and I checked the mp4 preview files generated by RS in the filestore by downloading them to my desktop and playing them with either Media Player or VLC and they were OK. Some of the formats will not play in the preview window on the website. Here are the results so far.

Format         Ingestion Result       Preview mp4 created      Preview Played on Website
MTS (AVCHD)    OK                     YES                      YES
WMV            OK                     YES                      YES
AVI            OK                     YES                      NO
MOV            OK                     YES                      NO
FLV            OK                     YES                      YES

What could be going on here? I can't say if this is a VideoJS, an FFMPEG or a php code error.

Cheers,

Peter Romão

unread,
May 7, 2012, 6:38:58 AM5/7/12
to resour...@googlegroups.com
OK I must give some additional info here. I just remembered that this could be associated to a browser issue and therefore I tried both IE and Safari on the iPad. On both of these browsers the previews ran fine, no glitches whatsoever.

The results I showed earlier are associated to viewing RS on Chrome.

Could this be a chrome thing Or VideoJS is not 100% compatible with Chrome?

Cheers,

mrpatulski

unread,
May 7, 2012, 11:22:00 AM5/7/12
to resour...@googlegroups.com
[1] Are you testing the same file rendered to different formats or using what you have at hand to render new mp4s?  
[2] What are the dimensions of the failing files.
[3] Can you download the previews of the MOV and the AVI and play locally?

VideoJS works in chrome--here is the site:

Peter Romão

unread,
May 7, 2012, 6:00:43 PM5/7/12
to resour...@googlegroups.com
Hello Matt,

[1] Not sure where this is going but here it goes. Given that I wanted to have the testing of near to real conditions with all the associated stress I decided I would get a representative population of clips from my personal collection of videos. These are NOT the same file rendered into different formats. These clips travelled through time and indeed several computers and they originated in ingesting from a Panasonic DV Camera, an Olympus P&S with crappy video, a Canon AVCHD video camera, a Sanyo Xacti camera and a Kodak mini something which recorded QT movs, etc. So in your words it is what I had at hand.

[2] This is one of the files failing:

General
Complete name                            : F:\Paulo files\Movies\P8210127.AVI
Format                                   : AVI
Format/Info                              : Audio Video Interleave
File size                                : 9.60 MiB
Duration                                 : 32s 0ms
Overall bit rate                         : 2 517 Kbps
Mastered date                            : 2010-08-21 10:53:04
Writing application                      : OLYMPUS FE5020,X935
Writing library                          : OLYMDigital CameraOLYMPUS DIGITAL CAMERA

Video
ID                                       : 0
Format                                   : JPEG
Codec ID                                 : MJPG
Duration                                 : 32s 0ms
Source duration                          : 31s 600ms
Bit rate                                 : 2 478 Kbps
Width                                    : 320 pixels
Height                                   : 240 pixels
Display aspect ratio                     : 4:3
Frame rate                               : 15.000 fps
Color space                              : YUV
Chroma subsampling                       : 4:2:2
Bit depth                                : 8 bits
Scan type                                : Progressive
Compression mode                         : Lossy
Bits/(Pixel*Frame)                       : 2.151
Stream size                              : 9.34 MiB (97%)

Audio
ID                                       : 1
Format                                   : PCM
Format settings, Sign                    : Unsigned
Codec ID                                 : 1
Duration                                 : 31s 600ms
Bit rate mode                            : Constant
Bit rate                                 : 64.0 Kbps
Channel(s)                               : 1 channel
Sampling rate                            : 8 000 Hz
Bit depth                                : 8 bits
Stream size                              : 247 KiB (3%)
Interleave, duration                     : 988 ms (14.81 video frames)
Interleave, preload duration             : 1000 ms

and this is the other.

General
Complete name                            : F:\Picture 062.MOV
Format                                   : MPEG-4
Format profile                           : QuickTime
Codec ID                                 : qt  
File size                                : 159 MiB
Duration                                 : 29s 600ms
Overall bit rate                         : 45.1 Mbps
Encoded date                             : UTC 2010-08-21 13:02:08
Tagged date                              : UTC 2010-08-21 13:02:08

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : Baseline@L5.0
Format settings, CABAC                   : No
Format settings, ReFrames                : 1 frame
Format settings, GOP                     : M=1, N=12
Codec ID                                 : avc1
Codec ID/Info                            : Advanced Video Coding
Duration                                 : 29s 600ms
Bit rate                                 : 43.6 Mbps
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Original height                          : 1 088 pixels
Display aspect ratio                     : 16:9
Original display aspect ratio            : 16:9
Frame rate mode                          : Constant
Frame rate                               : 25.000 fps
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Bits/(Pixel*Frame)                       : 0.840
Stream size                              : 154 MiB (97%)
Language                                 : English
Encoded date                             : UTC 2010-08-21 13:02:08
Tagged date                              : UTC 2010-08-21 13:02:08
Color primaries                          : BT.709-5, BT.1361, IEC 61966-2-4, SMPTE RP177
Transfer characteristics                 : BT.709-5, BT.1361
Matrix coefficients                      : BT.601-6 525, BT.1358 525, BT.1700 NTSC, SMPTE 170M

Audio
ID                                       : 2
Format                                   : PCM
Format settings, Endianness              : Little
Format settings, Sign                    : Signed
Codec ID                                 : sowt
Duration                                 : 29s 600ms
Bit rate mode                            : Constant
Bit rate                                 : 1 536 Kbps
Channel(s)                               : 2 channels
Channel positions                        : Front: L R
Sampling rate                            : 48.0 KHz
Bit depth                                : 16 bits
Stream size                              : 5.42 MiB (3%)
Language                                 : English
Encoded date                             : UTC 2010-08-21 13:02:08
Tagged date                              : UTC 2010-08-21 13:02:08

[3] Yes I can. the files playback faultlessly as do their ffmpeg generated previews.

About VideoJS working in Chrome I saw that they claim it does but these particualr files are failing for me.

Thanks in advance for your help.
Peter

mrpatulski

unread,
May 7, 2012, 6:37:09 PM5/7/12
to resour...@googlegroups.com
What are your render specs again--that are used by RS to make the mp4s?

Peter Romão

unread,
May 8, 2012, 4:50:33 PM5/8/12
to resour...@googlegroups.com
$ffmpeg_preview_options=" -s 480x270 -threads 0 -acodec libvo_aacenc -strict experimental -vcodec libx264 -crf 30.0 -ab 64KB -f mp4 ";

mrpatulski

unread,
May 9, 2012, 7:19:32 AM5/9/12
to resour...@googlegroups.com
Peter,
first off apologies. not reading the thread to carefully and asking you to repeat yourself. Sometimes mp4 won't play in a browser if the audio source is not correct.  Do all of the files have PCM as the source format or just the failing files? If so I wonder if a transcode to have them use the AAC codec would do the trick--taking a stab in the dark here.

Also, could you replace your audio codec setting with these--you will get better results overall.
-acodec libfaac -ac 1 -ab 64k
Reply all
Reply to author
Forward
0 new messages