Menu

#28 $movie = new ffmpeg_movie problem

open-works-for-me
general (27)
5
2006-09-07
2006-09-07
Anonymous
No

Hi, I am trying to bring up the ffmpeg and ffmpeg php
extension.

I installed all the packages from latest SVN source
and I am having problems with PHP extension (it
doesn't work).

When I am trying to launch test script
test_ffmpeg.php it crashed on this line:

$mov = new ffmpeg_movie( $movie );

Then I was trying to figure out the problem and
looked into PHP extension code (ffmpeg_movie.c)

I added some debug output to the ffmpeg_movie
constructor function and also I commented several
lines:

==================================================
....
} else {

zend_printf ( "987" );

ffmovie_ctx = _php_alloc_ffmovie_ctx(0);

if (_php_open_movie_file(ffmovie_ctx,
Z_STRVAL_PP(argv[0]))) {
zend_error(E_WARNING, "Can't open movie
file %s",
Z_STRVAL_PP(argv[0]));
efree(argv);
ZVAL_BOOL(getThis(), 0);
RETURN_FALSE;
}
/*
// pass NULL for resource result since we're
not returning the resource directly, but adding it to
the returned object.
ffmovie_ctx->rsrc_id = ZEND_REGISTER_RESOURCE
(NULL, ffmovie_ctx,
le_ffmpeg_movie);
*/
}

/*
object_init_ex(getThis(),
ffmpeg_movie_class_entry_ptr);
add_property_resource(getThis(), "ffmpeg_movie",
ffmovie_ctx->rsrc_id);

efree(argv);
if (fullpath) {
efree(fullpath);
}
if (hashkey) {
efree(hashkey);
}
*/

}

=====================================================

And after commenting the code SCRIPT STOPPED CRASHING!
And it started to throw out the warning "Can't open
movie file ..."

Then I went to function
static int _php_open_movie_file(ff_movie_context
*ffmovie_ctx, char* filename)
to investigate why it doesn't open the file and I saw
that error happens in this line:

if ( av_open_input_file(&(ffmovie_ctx->fmt_ctx),
filename, NULL, 0, &params)) {

After realizing this I added more debug output into
that function:

========================================
if ( k = av_open_input_file(&(ffmovie_ctx-
>fmt_ctx), filename, NULL, 0,
&params)) {
switch (k) {
case -1:
zend_printf ( "a" );
break;
case -2:
zend_printf ( "ab" );
break;
case -3:
zend_printf ( "ac" );
break;
case -4:
zend_printf ( "ad" );
break;
case -5:
zend_printf ( "ae" );
break;
case -6:
zend_printf ( "af" );
break;
case -7:
zend_printf ( "ag" );
break;
}
// zend_printf ( "c" ); // it happens there!

return -1;
}
=============================================

and I tried to play with input file:

when the file doesn't exist it return I/O Error -2
when the file was .jpg image it returned Unknown
Format Error -7
BUT!!! When I tried to supply existing valid .avi
or .mpg file it throws out Not Enough Memory Error -5
(????)

PHP allows more than 200 megabytes of memory and 100
megs for uploading files so I believe there is no
problem.

All these packages were downloaded 6 September 2006
(2006) from SVN and compiled first ffmpeg (all under
root):
./configure --enable-shared --prefix=/usr
make clean && make
make install

Then extension:
phpize
./configure
make

My PHP version is 4.3.11

Can you please tell me what am I doing wrong or there
is any error in what I did or maybe in the code (Not
enough Memory error?????)

Thank you for all your efforts in creation and
supporting this great product.
Can I join your team? I can be helpful in supporting
this.

Sincerely,
Dmitry Nessonov
A-Development Corp.
dnessonov@gmail.com

Discussion

  • Todd Kirby

    Todd Kirby - 2006-09-07
    • status: open --> open-works-for-me
     
  • Todd Kirby

    Todd Kirby - 2006-09-07

    Logged In: YES
    user_id=31420

    Cannot reproduce. Post your message on the ffmpeg google
    group, maybe someone has seen a similar problem and can
    help. I'll leave this open for your comments.

    -Todd

    BTW: I added error reporting for the av_open similar to what
    you have in your debugging. It is in SVN.

     
  • Piotr Kloc

    Piotr Kloc - 2006-09-10

    Logged In: YES
    user_id=504223

    I have the same problem
    .I have segmentation fault in logs
    ffmpeg from shell command working ok
    My phpinfo
    http://80.86.84.133/phpinfo.php

    gdb) bt
    #0 0xb7e55911 in pause () from /lib/tls/libc.so.6
    #1 0xb6ee36c9 in zend_oe () from
    /usr/local/Zend/lib/Optimizer-3.0.1/php-4.4.x/
    ZendOptimizer.so
    #2 <signal handler called>
    #3 0xb70d0054 in dsputil_init_mmx () from /usr/lib/
    libavcodec.so.51
    #4 0xb6f9c761 in dsputil_init () from /usr/lib/
    libavcodec.so.51
    #5 0xb6f6a1f6 in MPV_common_init () from /usr/lib/
    libavcodec.so.51
    #6 0xb70cb82b in ff_h263_decode_init () from /usr/lib/
    libavcodec.so.51
    #7 0xb6f67b0a in avcodec_open () from /usr/lib/
    libavcodec.so.51
    #8 0xb7330aed in av_write_image () from /usr/lib/
    libavformat.so.50
    #9 0xb732d775 in av_find_stream_info () from /usr/lib/
    libavformat.so.50
    #10 0xb74c5dd3 in _php_open_movie_file
    (ffmovie_ctx=0x8136e00,
    filename=0x811d424 "test.wmv")
    at /root/ffmpeg-php/ffmpeg_movie.c:214
    #11 0xb74c5f3c in zif_ffmpeg_movie (ht=136422420,
    return_value=0x80f423c,
    this_ptr=0x80e6c94, return_value_used=0)
    at /root/ffmpeg-php/ffmpeg_movie.c:326
    #12 0xb6e59293 in zend_oe () from
    /usr/local/Zend/lib/Optimizer-3.0.1/php-4.4.x/
    ZendOptimizer.so
    #13 0xb6e55a4c in zend_oe () from
    /usr/local/Zend/lib/Optimizer-3.0.1/php-4.4.x/
    ZendOptimizer.so
    #14 0xb7ab2ea9 in zend_execute_scripts (type=8, retval=0x0,
    file_count=3)
    at /usr/local/directadmin/customapache/php-4.4.4/Zend/
    zend.c:934
    #15 0xb7a88bdd in php_execute_script
    (primary_file=0xbfd60770)
    at /usr/local/directadmin/customapache/php-4.4.4/main/
    main.c:1752
    #16 0xb7ac50d9 in apache_php_module_main (r=0x81ef60c,
    display_source_mode=0)
    at
    /usr/local/directadmin/customapache/php-4.4.4/sapi/apache/
    sapi_apache.c:54
    #17 0xb7ac5aa9 in send_php (r=0x81ef60c,
    display_source_mode=0,
    filename=0x0)
    at
    /usr/local/directadmin/customapache/php-4.4.4/sapi/apache/
    mod_php4.c:626
    #18 0xb7ac5c33 in send_parsed_php (r=0x81ef60c) at
    /usr/local/directadmin/customapache/php-4.4.4/sapi/apache/
    mod_php4.c:641
    #19 0x08056496 in ap_invoke_handler ()
    #20 0x0806d313 in process_request_internal ()
    #21 0x0806d78f in ap_internal_redirect ()
    #22 0xb7d78e15 in handle_dir () from /etc/httpd/modules/
    mod_dir.so
    #23 0x08056496 in ap_invoke_handler ()
    #24 0x0806d313 in process_request_internal ()
    #25 0x0806d370 in ap_process_request ()
    #26 0x0806381b in child_main ()
    #27 0x08063aca in make_child ()
    #28 0x08063e38 in perform_idle_server_maintenance ()
    #29 0x080644d9 in standalone_main ()
    #30 0x08064b4e in main ()
    (gdb)

    Regards,
    Piotr kloc
    pioklo@serveradmin.pl

     
  • Fredrik

    Fredrik - 2006-12-29

    Logged In: YES
    user_id=1365442
    Originator: NO

    I too experienced sigfaults with dsputil_init_mmx () being where they occured.

    I compiled ffmpeg without mms (--disable-mmx) and now it works again - albeit I guess it it does so without the same speed as before...

    Using php 5.2.0 with Suhosin patch, Apache2 and ffmpeg-php v 0.5.0 btw.

    get audio sample rate = 0
    get video bit rate = 0

    Program received signal SIGSEGV, Segmentation fault.
    [Switching to Thread -1215280384 (LWP 23418)]
    0xb695fff5 in dsputil_init_mmx () from /usr/local/lib/libavcodec.so.51

    bt:
    #0 0xb695fff5 in dsputil_init_mmx () from /usr/local/lib/libavcodec.so.51
    #1 0xb67ed830 in ?? () from /usr/local/lib/libavcodec.so.51
    #2 0xb6d77135 in ?? () from /usr/lib/php5/20060613/ffmpeg.so
    #3 0x00000000 in ?? ()

     

Log in to post a comment.