www.webdeveloper.com
Results 1 to 5 of 5

Thread: php and ffmpeg questions

  1. #1
    Join Date
    Nov 2011
    Posts
    37

    php and ffmpeg questions

    Hello everyone,

    I am working on a project that allows users to upload video. For accessibility purpose, I need to convert the video file to .mp4, .ogv and .webm.

    So the idea is to use:

    1. input file to allow user to upload.

    2. After upload is completed, the php script will call 3 commands(I am planning to use shell_exec() to call these 3 commands).

    ffmpeg -i video.avi video.ogv
    ffmpeg -i video.avi video.ogv
    ffmpeg -i video.avi video.ogv



    My questions are:

    1. Am I doing it right? I ve seen a php extension call php_ffmpeg. Not sure if I can use it to achieve my goal instead.

    2. If I proceed to do those things above, Will there be a problem if I try to call those 3 commands at the same time? Will they even be executed? It takes a while for me to convert a small video by using the command prompt.

  2. #2
    Join Date
    Jan 2011
    Location
    Canada
    Posts
    125
    For starters, you will probably have to point php to your ffmpeg install. Not sure where that would be on a windows system, but in linux, you would use something like
    PHP Code:
    $ffmpeg "/usr/local/bin/ffmpeg"
    Then to actually execute your conversion, use something like
    PHP Code:
    $exec_string = ($ffmpeg " -i " $uploadFilename" -b:v 2000k -acodec libvorbis -ac 2 -ab 256k -threads 0 " $finout "");
       
    exec($exec_string); 
    Obviously, you need to set the variables for the original file name ($uploadFilename) and the name of your newly created output file ($finout). But that works for me. And depending on how you installed ffmpeg, you may find that you need to reinstall it. There are a variety of addons/extra codecs. For myself, I found the basic ffmpeg install would have issues with webm. I needed to install it with additional codecs activated.

    There's a good tutorial for that here
    https://ffmpeg.org/trac/ffmpeg/wiki/...mpilationGuide

    Be sure to follow all the "optional" steps as well.

  3. #3
    Join Date
    Jan 2011
    Location
    Canada
    Posts
    125
    And it won't run them all at once. It will do it sequentially.

  4. #4
    Join Date
    Nov 2011
    Posts
    37
    Thank you.

  5. #5
    Join Date
    Nov 2011
    Posts
    37
    neither exec or shell_exec can execute command prompt commands. They are meant to call shell script commands only I guess. Will need to install linux.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center

"

"

X vBulletin 4.2.2 Debug Information

  • Page Generation 0.11459 seconds
  • Memory Usage 2,876KB
  • Queries Executed 15 (?)
More Information
Template Usage (33):
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (2)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (5)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (5)postbit
  • (5)postbit_onlinestatus
  • (5)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (26):
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/functions_navigation.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_facebook.php
  • ./includes/functions_calendar.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_notice.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (70):
  • init_startup
  • friendlyurl_resolve_class
  • init_startup_session_setup_start
  • database_pre_fetch_array
  • database_post_fetch_array
  • init_startup_session_setup_complete
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • load_show_variables
  • load_forum_show_variables
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • strip_bbcode
  • friendlyurl_clean_fragment
  • friendlyurl_geturl
  • forumjump
  • cache_templates
  • cache_templates_process
  • template_register_var
  • template_render_output
  • fetch_template_start
  • fetch_template_complete
  • parse_templates
  • fetch_musername
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • build_navigation_data
  • build_navigation_array
  • check_navigation_permission
  • process_navigation_links_start
  • process_navigation_links_complete
  • set_navigation_menu_element
  • build_navigation_menudata
  • build_navigation_listdata
  • build_navigation_list
  • set_navigation_tab_main
  • set_navigation_tab_fallback
  • navigation_tab_complete
  • fb_like_button
  • showthread_complete
  • page_templates