Menu

#6 2 or more streams in container.

open
None
5
2005-01-11
2005-01-10
[-Alt-]
No

Sorry, english is not my native language but i try to
explain. Some container, like ogm, may contain 2 or
more audio (or video) streams.
$movie->getAudioCodec() return only one value. May be
good idea to replace return value with array like

array[0] value for 1st stream
array[1] value from 2nd stream
array[......

or add optional parameter to function like
getAudioCodec([stream_num])

or somthing like:

getAudioStreamInfo([stream_num])
with return value like
array['codec']
array['channels']
array['bitrate']

And some words about $movie->getVideoCodec()
This functions return some value "mpeg4" for divx and
xvid encoded files. I think it will be better to return
in this function value "fourcc" taking place in a file.

Discussion

  • Todd Kirby

    Todd Kirby - 2005-01-11

    Logged In: YES
    user_id=31420

    It's difficult to balance between making the functions
    powerful and making them easy to use for PHP scripters who
    don't really want to deal with the nuances of container
    formats and streams. I'll probably leave the versions of
    getAudio/VideoCodec() like they are so scripters who just
    wants an easy way to show the format of media files isn't
    overwhelmed by the API.

    What about an additional getCodec(stream_num) function that
    will return an ffmpeg_codec object with accessors for type
    (audio or video), codec, bitrate and whatever other codec
    params make sense? This would map pretty cleanly to
    libavcodec api.

     
  • Todd Kirby

    Todd Kirby - 2005-01-11
    • assigned_to: nobody --> tkirby
     
  • [-Alt-]

    [-Alt-] - 2005-01-11

    Logged In: YES
    user_id=1194271

    What about the value returned by function getVideoCodec()?
    I think 'fourcc' will be more informative.
    ("DIVX", "DIV5", "XVID", "DIV3" stored in fourcc are more
    informative then "mpeg4")

     
  • Todd Kirby

    Todd Kirby - 2005-01-12

    Logged In: YES
    user_id=31420

    ffmpeg's demuxers map fourcc to a codec id number internally
    and there is no API call to map this back to a fourcc. From
    reading the ffmpeg source it looks like there's a master
    codec id list, but it doesn't have the corresponding fourcc.
    Each demuxer has its own list of fourcc's that it deals
    with. This means in order to return fourcc in PHP, I'd have
    to maintain a mapping of the id <-> fourcc somewhere inside
    ffmeg-php. I'll ask on the list

    There's a codec_tag field in AVCodec that is supposed to
    contain foucc, but it doesn't seem to get set in all cases.
    I'll ask on ffmpeg-devel about a reliable way to return fourcc.

     
  • Nobody/Anonymous

    Logged In: NO

    Slight variation to the request but along the same lines.

    Real or Windows Media formats can also have multiple audio or video streams. ffmpeg is capable of identifying all of them but defaults to the last (highest) id i believe, usually returning the lowest bandwidth version, unless otherwise specified using -aid or -vid. Having array results in that case would be excellent.

    In order to maintain the integrity of the API, how about a getNumberOfAudio(video)Streams() function, then when calling the other relevant functions you add an optional parameter at the end which is the stream id.

    thanks

     

Log in to post a comment.