Documentation & tutorials

Integrate Panda with your web, mobile or desktop app.

FFmpeg Neckbeard

Panda provides complete control over the commands used to convert video. You can log in to your Panda Dashboard and choose from our presets, or you can use the API to access the bare metal.


As ffmpeg API changes, we can't always update ffmeg without breaking your commands. That's where presets become handy. To make sure your commands are backward compatible with the encoding API and ffmpeg's API, we are using separate stacks of tools. The default stack is corepack-1. There is also corepack-2 and corepack-3. Corepack-1 will be deprecated soon and replaced by corepack-2. However, all profiles created with the previous stack will continue to work.

If you use API to create your profiles and want to stay on the old stack, make sure you specify 'stack' => 'corepack-1'. You can find the 'corepack-1' docs here

We highly recommend to switch to presets or to the newest stack (corepack-3). It improves encoding/decoding speed and formats/codecs support.


All of the fields below are required when creating an advanced profile.

extname:          File extension, beginning with '.', of the output video.
          command:          Video conversion command (in most cases an ffmpeg command).
          name:             Which is a unique name inside your cloud to reference your profile.

Panda provides full access to a suite of powerful video conversion tools. These tools can be used together in one profile to output a variety of formats.

To execute multiple commands in one profile, you must separate each with a \n (newline) or ; (semicolon).

Note: In php, if you are using double quotes in string, don't forget to escape `$` or profile variables will be considered as php variables. command => " ...\$input\$ "

Panda provides a few api tokens you can use in your commands:

$input_file$:          input filename
          $output_file$:         output filename
          $width$:               width defined in your profile
          $height$:              height defined in your profile
          $record_id$:           encoding ID
          $filters$:             scale your video considering the aspect mode and resolution attributes of your profile.
          $audio_sample_rate$:   audio sample rate
          $audio_channels$:      audio channels (default: copy)
          $audio_bitrate$:       audio_bitrate
          $video_quality$:       video bitrate or h264 crf
          $video_bitrate$:       video_bitrate only
          $max_audio_bitrate$:   audio bitrate threshold
          $max_video_bitrate$:   video bitrate threshold
          $fps$:                 frame rate (default: copy)
          $clip$:                subset of the video to be encoded

H264 specific tokens

$h264_profile$:   h264 profile (baseline, main, high)
          $h264_level$:     h264 level (1.3, 3.0, 3.1,...)


Let's create a custom h.264 profile.

            :stack => "corepack-3",
            :name => "h264.SD",
            :width => 480,
            :height => 320,
            :h264_crf => 23,
            :audio_bitrate => 128,
            :extname => ".mp4",
            :audio_sample_rate => 44100,
            :keyframe_interval => 250,
            :command => "ffmpeg -i $input_file$ -threads 0 -c:a libfaac -c:v libx264 -preset medium $video_quality$ $audio_bitrate$ $audio_sample_rate$ $keyframes$ $fps$ -y video_tmp_noqt.mp4\nqt-faststart video_tmp_noqt.mp4 $output_file$"
          $panda->post('/profiles.json', array(
              'stack' => "corepack-3",
              'name' => "h264.SD",
              'width' => 480,
              'height' => 320,
              'h264_crf' => 23,
              'audio_bitrate' => 128,
              'extname' => ".mp4",
              'audio_sample_rate' => 44100,
              'keyframe_interval' => 250,
              'command' => 'ffmpeg -i $input_file$ -threads 0 -c:a libfaac -c:v libx264 -preset medium $video_quality$ $audio_bitrate$ $audio_sample_rate$ $keyframes$ $fps$ -y video_tmp_noqt.mp4\nqt-faststart video_tmp_noqt.mp4 $output_file$'

You may not find a preset for your exactly need but the following examples should help you to encode videos into some popular formats.


            :stack => "corepack-3",
            :name => "flv",
            :width => 480,
            :height => 320,
            :video_bitrate => 500,
            :audio_bitrate => 128,
            :extname => ".flv",
            :command => "ffmpeg -i $input_file$ -threads 0 $audio_sample_rate$ $video_bitrate$ $audio_bitrate$ $fps$ $filters$ -y $output_file$"


            :stack => "corepack-3",
            :name => "avi",
            :width => 480,
            :height => 320,
            :video_bitrate => 500,
            :audio_bitrate => 128,
            :extname => ".avi",
            :command => "ffmpeg -i $input_file$ -threads 0 -c:v msmpeg4 -c:a libmp3lame -tag:v MP43 $audio_sample_rate$ $audio_sample_rate$ $video_bitrate$ $audio_bitrate$ $fps$ $filters$ -y $output_file$"


            :stack => "corepack-3",
            :name => "wmv",
            :width => 480,
            :height => 320,
            :video_bitrate => 500,
            :audio_bitrate => 128,
            :extname => ".wmv",
            :command => "ffmpeg -i $input_file$ -threads 0 -c:v wmv2 -c:a wmav2 $audio_sample_rate$ $video_bitrate$ $audio_bitrate$ $fps$ $filters$ -y $output_file$"

OGG - 2 pass

Our presets support two pass encoding but if you need the command, here is the way to do it:

              :stack => "corepack-3",
              :name => "ogg.2pass",
              :width => 480,
              :height => 320,
              :video_bitrate => 500,
              :audio_bitrate => 128,
              :extname => ".ogg",
              :command => "ffmpeg -i $input_file$ -f ogg -pass 1 -threads 0 -c:v libtheora -c:a libvorbis $audio_sample_rate$ $video_bitrate$ $audio_bitrate$ $fps$ $filters$ -y /dev/null\nffmpeg -i $input_file$ -f ogg -pass 2 -threads 0 -c:v libtheora -c:a libvorbis $audio_sample_rate$ $video_bitrate$ $audio_bitrate$ $fps$ $filters$ -y $output_file$"

Available conversion tools

Here is the list of conversion tools available in Panda.



FFmpeg is a complete, cross-platform solution to record, convert and stream audio and video. It includes libavcodec - the leading audio/video codec library.

We provide a recent version of ffmpeg, compiled from the git repository with as many codecs as we could get our hands on (See full list of Supported File Formats and Codecs).

command name: ffmpeg
          command version: Ffmpeg 0.10



LAME is a high quality MPEG Audio Layer III (MP3) encoder.

command name: lame
          command version: Lame 3.99


See http://

An other video encoder built from the same code as MPlayer.

command name: mencoder


Segmenter divides input file into smaller parts for HLS playlists.

command name: segmenter


Manifester is a tool to create m3u8 manifest file.

command name: manifester



Moves the moov atom in front of the data to improve network streaming.

command name: qt-faststart



QtRotate is a tool to work with rotated files.

command name: qtrotate



Yamdi is a metadata injector for FLV files.

command name: yamdi



Mp4Box is a tool for manipulating multimedia files.

command name: MP4Box