Upload video error [solved]

edited May 2015 in Bugs and Errors
Hoping this is just setting error that can be easily resolved.
Sorry to keep taking your time up.

So I uploaded a small video to test the script. Below are the error logs.
Convertor.log:
// Converter Called...
Values passed to encoder:
Array
(
[0] => /home/dcom/public_html/cc-core/system/encode.php
[1] => --video=4
)

Validating requested video...
Establishing variables...
Verifying raw video exists...
Verifying raw video was valid size...

Preparing for: H.264 Encoding...
H.264 Encoding Command: /usr/local/bin/ffmpeg -i /home/dcom/public_html/cc-content/uploads/temp/Q0VqG3vi9ORbjy8QqwtR.wmv -vcodec libx264 -vf "scale=min(640\,iw):trunc(ow/a/2)*2" -vb 800k -acodec libfaac -ab 96k -ar 44100 -f mp4 /home/dcom/public_html/cc-content/uploads/h264/Q0VqG3vi9ORbjy8QqwtR_temp.mp4 >> /home/dcom/public_html/cc-core/logs/Q0VqG3vi9ORbjy8QqwtR.log 2>&1
Verifying H.264 video was created...
The temp H.264 file was not created. The id of the video is: 4


##################################################################

==================================================================
H.264 ENCODING
==================================================================

H.264 Encoding Command: /usr/local/bin/ffmpeg -i /home/dcom/public_html/cc-content/uploads/temp/Q0VqG3vi9ORbjy8QqwtR.wmv -vcodec libx264 -vf "scale=min(640\,iw):trunc(ow/a/2)*2" -vb 800k -acodec libfaac -ab 96k -ar 44100 -f mp4 /home/dcom/public_html/cc-content/uploads/h264/Q0VqG3vi9ORbjy8QqwtR_temp.mp4 >> /home/dcom/public_html/cc-core/logs/Q0VqG3vi9ORbjy8QqwtR.log 2>&1

H.264 Encoding Output:


/usr/local/bin/ffmpeg: line 4: /var/log/ffmpeg.log: Permission denied
FFmpeg version SVN-r26402, Copyright (c) 2000-2011 the FFmpeg developers
built on Sep 18 2011 15:33:05 with gcc 4.1.2 20080704 (Red Hat 4.1.2-51)
configuration: --enable-libmp3lame --enable-libvorbis --enable-libfaac --enable-libtheora --enable-libx264 --enable-libxvid --disable-mmx --enable-gpl --enable-nonfree --enable-avcore --enable-avdevice --enable-avcodec --enable-avcore --enable-avformat --enable-swscale --enable-shared
libavutil 50.36. 0 / 50.36. 0
libavcore 0.16. 1 / 0.16. 1
libavcodec 52.108. 0 / 52.108. 0
libavformat 52.93. 0 / 52.93. 0
libavdevice 52. 2. 3 / 52. 2. 3
libavfilter 1.74. 0 / 1.74. 0
libswscale 0.12. 0 / 0.12. 0

Seems stream 1 codec frame rate differs from container frame rate: 1000.00 (1000/1) -> 29.97 (30000/1001)
Input #0, asf, from '/home/dcom/public_html/cc-content/uploads/temp/Q0VqG3vi9ORbjy8QqwtR.wmv':
Metadata:
SfOriginalFPS : 299
WMFSDKVersion : 11.0.6001.7000
WMFSDKNeeded : 0.0.0.0000
IsVBR : 0
title : Wildlife in HD
artist :
copyright : © 2008 Microsoft Corporation
comment : Footage: Small World Productions, Inc; Tourism New Zealand | Producer: Gary F. Spradling | Music: Steve Ball
Duration: 00:00:30.09, start: 8.000000, bitrate: 6977 kb/s
Stream #0.0(eng): Audio: wmav2, 44100 Hz, 2 channels, s16, 192 kb/s
Stream #0.1(eng): Video: vc1, yuv420p, 1280x720, 5942 kb/s, 29.97 tbr, 1k tbn, 1k tbc
[buffer @ 0x1388a600] w:1280 h:720 pixfmt:yuv420p
[scale @ 0x1388aaf0] w:1280 h:720 fmt:yuv420p -> w:1280 h:720 fmt:yuv420p flags:0x4
[libx264 @ 0x138798f0] broken ffmpeg default settings detected
[libx264 @ 0x138798f0] use an encoding preset (e.g. -vpre medium)
[libx264 @ 0x138798f0] preset usage: -vpre -vpre
[libx264 @ 0x138798f0] speed presets are listed in x264 --help
[libx264 @ 0x138798f0] profile is optional; x264 defaults to high
Output #0, mp4, to '/home/dcom/public_html/cc-content/uploads/h264/Q0VqG3vi9ORbjy8QqwtR_temp.mp4':
Stream #0.0(eng): Video: libx264, yuv420p, 1280x720, q=2-31, 800 kb/s, 90k tbn, 29.97 tbc
Stream #0.1(eng): Audio: libfaac, 44100 Hz, 2 channels, s16, 96 kb/s
Stream mapping:
Stream #0.1 -> #0.0
Stream #0.0 -> #0.1
Error while opening encoder for output stream #0.0 - maybe incorrect parameters such as bit_rate, rate, width or height

Comments

  • It looks like you're using an old version of FFMPEG. Ask your web host if they have the newer version installed and what's the path. They usually have more than one.

    Let's try that first because the error being listed a very generic. It usually means that the encoding options aren't well understood or valid. The valid part isn't an issue though because you haven't changed them yet.
  • Ok the host provider have come back asking for more information before they can assist further, see response below:

    To clarify, please provide us with the exact FFMPEG version you need along with the exact URL of your installation software so that we can review further.

  • They seem confused. Ideally we would want the latest version of FFMPEG which currently is v2.6.2. However any version from the last 2 years will suffice. Yours is from 2011.

    As far as the url, I don't see why they would need that but I guess they're asking for the irk to your CumulusClips instance.
  • Host provided a new path to ffmpeg.
    So i've tried uploading another video. Logs show the following:


    ==================================================================
    H.264 ENCODING
    ==================================================================

    H.264 Encoding Command: /usr/share/ffmpeg -i /home/dcom/public_html/cc-content/uploads/temp/iun1qohwkiRByzVoYRay.wmv -vcodec libx264 -vf "scale=min(640\,iw):trunc(ow/a/2)*2" -vb 800k -acodec libfaac -ab 96k -ar 44100 -f mp4 /home/dcom/public_html/cc-content/uploads/h264/iun1qohwkiRByzVoYRay_temp.mp4 >> /home/dcom/public_html/cc-core/logs/iun1qohwkiRByzVoYRay.log 2>&1

    H.264 Encoding Output:


    sh: /usr/share/ffmpeg: is a directory


    and


    // Converter Called...
    Values passed to encoder:
    Array
    (
    [0] => /home/dcom/public_html/cc-core/system/encode.php
    [1] => --video=6
    )

    Validating requested video...
    Establishing variables...
    Verifying raw video exists...
    Verifying raw video was valid size...

    Preparing for: H.264 Encoding...
    H.264 Encoding Command: /usr/share/ffmpeg -i /home/dcom/public_html/cc-content/uploads/temp/iun1qohwkiRByzVoYRay.wmv -vcodec libx264 -vf "scale=min(640\,iw):trunc(ow/a/2)*2" -vb 800k -acodec libfaac -ab 96k -ar 44100 -f mp4 /home/dcom/public_html/cc-content/uploads/h264/iun1qohwkiRByzVoYRay_temp.mp4 >> /home/dcom/public_html/cc-core/logs/iun1qohwkiRByzVoYRay.log 2>&1
    Verifying H.264 video was created...
    The temp H.264 file was not created. The id of the video is: 6


    Is this something to report back to my host?
  • The error in the log above is:

    sh: /usr/share/ffmpeg: is a directory

    can you do a directory listing of that directory and report back here?

    or run the following shell command:

    find /usr/share/ffmpeg -name ffmpeg
  • edited April 2015
    Sorry, hope I got this right.
    Is this what you were after? This is what is present within that directory.

    libx264-baseline.ffpreset
    libx264-fast.ffpreset
    libx264-fast_firstpass.ffpreset
    libx264-faster.ffpreset
    libx264-faster_firstpass.ffpreset
    libx264-ipod320.ffpreset
    libx264-ipod640.ffpreset
    libx264-lossless_fast.ffpreset
    libx264-lossless_max.ffpreset
    libx264-lossless_medium.ffpreset
    libx264-lossless_slow.ffpreset
    libx264-lossless_slower.ffpreset
    libx264-lossless_ultrafast.ffpreset
    libx264-main.ffpreset
    libx264-medium.ffpreset
    libx264-medium_firstpass.ffpreset
    libx264-normal.ffpreset
    libx264-placebo.ffpreset
    libx264-placebo_firstpass.ffpreset
    libx264-slow.ffpreset
    libx264-slow_firstpass.ffpreset
    libx264-slower.ffpreset
    libx264-slower_firstpass.ffpreset
    libx264-superfast.ffpreset
    libx264-superfast_firstpass.ffpreset
    libx264-ultrafast.ffpreset
    libx264-ultrafast_firstpass.ffpreset
    libx264-veryfast.ffpreset
    libx264-veryfast_firstpass.ffpreset
    libx264-veryslow.ffpreset
    libx264-veryslow_firstpass.ffpreset
  • Ok, so /usr/share/ffmpeg in your case is where the various ffmpeg presets are stored. It does NOT contain the actual ffmpeg binary.

    Does /usr/local/bin/ffmpeg exist on your server? If so, set that as your ffmpeg path.
  • Based on the output you provided, the new path your webhost gave you is incorrect. You need a path to the FFMPEG binary. This is an actual executable file not a directory like they gave you. This is why the encoding failed.

    As GreenMotion said, check if it exists in local bin with this command:

    ls /usr/local/bin | grep ffmpeg

    Also, let's see if it located somewhere else,try this command:

    whereis ffmpeg
  • edited April 2015
    /usr/local/bin/ffmpeg is a directory which does contain ffmpeg. However this was the original one used which returned the error as it was an outdated one from 2011. They then gave me /usr/share/ffmpeg after my request for a directory for a newer version.
    Seems whoever helped didn't have a clue. I have reported back further for them to correct and refer to my original request, also pointing out the error with the new directory.

    Unfortunately they haven't allowed me shell access either so can't do those commands. I only have shared hosting as my use for this will be small to start and not worth the £££ for a dedicated server. If this improves I will upgrade but not yet.

    Thanks for the help so far guys, hopefully they will come back will the correct path and it will work. Although not new with web software etc the video converting is alien to me. Starting to learn now though :)
  • edited May 2015
    Some web hosts also add an FFMPEG binary at: /usr/bin/ffmpeg

    Try setting that as your FFMPEG path, it's worth the try while you wait for a response from your webhost.

    Let us know if there is anything we can help with in the meantime.
  • In a fair bit of dialogue with the hosts at present trying to resolve this. Bit of back and forth at present.
    Adding a php.ini file and a line to the .htaccess so far. Still not getting it to work.

    The path above (/usr/bin/ffmpeg) returns an error when I save it. The script itself auto defaults to /usr/local/bin/ffmpeg /usr/share/ffmpeg when I leave the ffmpeg field blank. However If I press save again with this path present it returns an error (below)

    The following errors were found. Please correct them and try again.

    - Invalid path to FFMPEG?

    After a quick test today after the php.ini file and edit to .htaccess
    I now get the following error returned:
    No file was uploaded. Please try again.
    after attempting to upload a file.

    Something new. This was using both /usr/local/bin/ffmpeg /usr/share/ffmpeg
    &
    /usr/local/bin/ffmpeg
    as the paths

  • These two issues are unrelated. The "no file was uploaded" error is due to php configuration. Either enable_uploads or something similar is turned off preventing uploads.

    The ffmpeg path issue, you need a more modern version of ffmpeg. We can work around this problem temporarily, though the quality will be horrible and videos won't work for all users. Let me know if you want to go this route until your web host cooperates.
  • I'll try get a more up to date ffmpeg running first before any work around.

    hmmm strange how uploads no longer work. This is all that's been done so far.
    line added to .htaccess as advised by host use ffmpeg

    suPHP_ConfigPath /home/dcom/public_html

    & php.ini created with:

    extension=ffmpeg.so

    extension=pdo.so
    extension=pdo_mysql.so
    extension=pdo_sqlite.so
    extension=sqlite.so
  • I think the suPHP has something to do with your uploads problem. Try commenting out and trying again. Also make sure "file_uploads" is on in your ini as I mentioned earlier.
  • Ok, so after waiting a long time. It turns out they dont have any servers running a newer version of ffmpeg, which is rather frustrating. They wont upgrade it either.
    So I'm unsure what now needs to be done. Did you mention a work around?
  • Who is your webhost just out of curiosity?

    The workaround consists of stripping out the modern features of the encoding commands which aren't compatible with the version of ffmpeg installed on your server. We are going to strip them out one at a time until we find an options that works. Just be aware that you may end up with lower quality videos.

    First go to Admin Panel -> Settings -> Video and change the encoding options to the following:

    h.264 Options:
    -vcodec libx264 -s 640x480 -vb 800k -acodec libfaac -ab 96k -ar 44100

    Mobile Options:
    -vcodec libx264 -s 480x360 -vb 800k -acodec libfaac -ab 96k -ar 44100

    Thumbnail Options:
    -s 640x480 -t 1 -r 1 -f mjpeg

    These will force the video sizes into preset sizes which may slightly distort the output proportions. You may still have problems with videos that won't conform into those sizes (usually due to sizes that aren't divisible by 2).

    Be sure to purge your logs before testing it out so that you can pin point any errors. Let me know how that goes.

    At the end of the day, only you can decide what quality is best for your needs. Do some research on FFMPEG encoding options so that you can play around with the settings which give you the quality you want. See here:

    https://www.ffmpeg.org/ffmpeg.html
  • Pacific Host i'm with.
    I'd be fine if i took out a VPS but i don't think the cost is beneficial for my use at present.

    Ok i'll try the above and report back
  • Ok all done. I reverted everything back to standard. So .htaccess edits and php.ini taken out.
    Made the encoding edits and tested out a file.

    Logs:
    ==================================================================
    H.264 ENCODING
    ==================================================================

    H.264 Encoding Command: /usr/local/bin/ffmpeg -i /home/dcom/public_html/cc-content/uploads/temp/OcHl6D7qGFvC0VhCPlwn.wmv -vcodec libx264 -s 640x480 -vb 800k -acodec libfaac -ab 96k -ar 44100 /home/dcom/public_html/cc-content/uploads/h264/OcHl6D7qGFvC0VhCPlwn_temp.mp4 >> /home/dcom/public_html/cc-core/logs/OcHl6D7qGFvC0VhCPlwn.log 2>&1

    H.264 Encoding Output:


    /usr/local/bin/ffmpeg: line 4: /var/log/ffmpeg.log: Permission denied
    FFmpeg version SVN-r26402, Copyright (c) 2000-2011 the FFmpeg developers
    built on Sep 18 2011 15:33:05 with gcc 4.1.2 20080704 (Red Hat 4.1.2-51)
    configuration: --enable-libmp3lame --enable-libvorbis --enable-libfaac --enable-libtheora --enable-libx264 --enable-libxvid --disable-mmx --enable-gpl --enable-nonfree --enable-avcore --enable-avdevice --enable-avcodec --enable-avcore --enable-avformat --enable-swscale --enable-shared
    libavutil 50.36. 0 / 50.36. 0
    libavcore 0.16. 1 / 0.16. 1
    libavcodec 52.108. 0 / 52.108. 0
    libavformat 52.93. 0 / 52.93. 0
    libavdevice 52. 2. 3 / 52. 2. 3
    libavfilter 1.74. 0 / 1.74. 0
    libswscale 0.12. 0 / 0.12. 0

    Seems stream 1 codec frame rate differs from container frame rate: 1000.00 (1000/1) -> 29.97 (30000/1001)
    Input #0, asf, from '/home/dcom/public_html/cc-content/uploads/temp/OcHl6D7qGFvC0VhCPlwn.wmv':
    Metadata:
    SfOriginalFPS : 299
    WMFSDKVersion : 11.0.6001.7000
    WMFSDKNeeded : 0.0.0.0000
    IsVBR : 0
    title : Wildlife in HD
    artist :
    copyright : © 2008 Microsoft Corporation
    comment : Footage: Small World Productions, Inc; Tourism New Zealand | Producer: Gary F. Spradling | Music: Steve Ball
    Duration: 00:00:30.09, start: 8.000000, bitrate: 6977 kb/s
    Stream #0.0(eng): Audio: wmav2, 44100 Hz, 2 channels, s16, 192 kb/s
    Stream #0.1(eng): Video: vc1, yuv420p, 1280x720, 5942 kb/s, 29.97 tbr, 1k tbn, 1k tbc
    [buffer @ 0x3936560] w:1280 h:720 pixfmt:yuv420p
    [scale @ 0x3936930] w:1280 h:720 fmt:yuv420p -> w:640 h:480 fmt:yuv420p flags:0x4
    [libx264 @ 0x39258f0] broken ffmpeg default settings detected
    [libx264 @ 0x39258f0] use an encoding preset (e.g. -vpre medium)
    [libx264 @ 0x39258f0] preset usage: -vpre -vpre
    [libx264 @ 0x39258f0] speed presets are listed in x264 --help
    [libx264 @ 0x39258f0] profile is optional; x264 defaults to high
    Output #0, mp4, to '/home/dcom/public_html/cc-content/uploads/h264/OcHl6D7qGFvC0VhCPlwn_temp.mp4':
    Stream #0.0(eng): Video: libx264, yuv420p, 640x480, q=2-31, 800 kb/s, 90k tbn, 29.97 tbc
    Stream #0.1(eng): Audio: libfaac, 44100 Hz, 2 channels, s16, 96 kb/s
    Stream mapping:
    Stream #0.1 -> #0.0
    Stream #0.0 -> #0.1
    Error while opening encoder for output stream #0.0 - maybe incorrect parameters such as bit_rate, rate, width or height


    #####


    // Converter Called...
    Values passed to encoder:
    Array
    (
    [0] => /home/dcom/public_html/cc-core/system/encode.php
    [1] => --video=14
    )

    Validating requested video...
    Establishing variables...
    Verifying raw video exists...
    Verifying raw video was valid size...

    Preparing for: H.264 Encoding...
    H.264 Encoding Command: /usr/local/bin/ffmpeg -i /home/dcom/public_html/cc-content/uploads/temp/OcHl6D7qGFvC0VhCPlwn.wmv -vcodec libx264 -s 640x480 -vb 800k -acodec libfaac -ab 96k -ar 44100 /home/dcom/public_html/cc-content/uploads/h264/OcHl6D7qGFvC0VhCPlwn_temp.mp4 >> /home/dcom/public_html/cc-core/logs/OcHl6D7qGFvC0VhCPlwn.log 2>&1
    Verifying H.264 video was created...
    The temp H.264 file was not created. The id of the video is: 14
  • Ok, round 2

    Purge your logs and try this:

    h.264 Options:
    -vcodec copy -acodec libfaac -ab 96k -ar 44100

    Mobile Options:
    -vcodec copy -acodec libfaac -ab 96k -ar 44100

    Thumbnail Options:
    -s 640x480 -t 1 -r 1 -f mjpeg
  • Thank you for all the help. That appears to have got it.

    Now time to finish designing the place and learning more about ffmpeg so I can try get the perfect setup and the encoding options.

    Thanks again
This discussion has been closed.