Skip to main content

You don’t need transcoding

Well, not always. Sometimes muxing might be a better option.

Muxing is the process of packing encoded streams into another container format while preserving your video and audio codecs. There is no actual transcoding or modifying your video streams. It is just changing the most external video shell.

 

Muxing at it's finest
Muxing at it’s finest

 

A few days ago we have added new preset in Panda called “HLS Muxing Variant”. You can easily guess what it does with the input video. The most important thing about transmuxing is that it takes less time comparing to traditional encoding to “HLS Variant” as it is not changing resolution, bitrate, etc. That’s why we priced it as low as ¼ of standard video minute, no matter the size or resolution of source video.

It may sound complicated so here’s an real life example. Let’s assume you have HQ source video and it is H264, AAC encoded video with 2000k bitrate. Re-encoding is always time consuming and and impacts quality so you can use transmuxing to only change format. You may say that HLS is adaptive streaming technology so you need more that one bitrate. You’re right! It is. You can create two other profiles for 1000k and 500k. And variants playlist as well.

Panda::Profile.create!({

:preset_name => "hls.muxer",

:bitrate => 2000, # this three values are for variant.playlist

:width => 1280,

:height => 720

})

Panda::Profile.create!({

:preset_name => "hls.variant",

:video_bitrate => 1000

})

Panda::Profile.create!({

:preset_name => "hls.variant",

:video_bitrate => 500

})

Panda::Profile.create!({

:preset_name => "hls.variant.playlist",

:variants => "hls.*"

})

Now you can send our HQ source video to Panda. The output will be 1 master playlist, 3 variants playlist and 3 groups of segments (and some screenshots). With these in place you are ready to serve your adaptive streaming content.

Give it a try. If you have any problems remember that we are here for you and we are always happy to help.

ISO base format: “ftyp” box

Curious clients like the ones we have in Panda are such a joy to work with. One of them sent us a great question about ftyp headers in MPEG-4.

ISO base media file format (aka MPEG-4 Part 12) is the foundation of a set of formats, MP4 being the most popular. It was inspired by the QuickTime’s format, an then generalized in an official ISO standard. Then other formats used this ISO spec as a base and added their own functionality (sometimes in an incompatible way). For example, when Adobe created F4V – the successor of FLV –  it used MPEG-4 Part 12 too but needed a way of packing ActionScript objects into the new format. Long story short,  F4V turned out a weird combination of MP4 and Flash.

Anyway, all MPEG4 Part 12 files consist of information units known as ‘boxes’. One of the kinds of these boxes is ftyp, which contains information about the variant of ISO-based format the file uses.  In general, every new variant should be registered on mp4ra.org, but that’s not always the case. Full list of possible ftyp values (registered and non-registered)  is maintained on ftyps.com website.

Majority of MP4 files produced by Panda will be labelled as ISOM (the most general label), but you might want to use a different label. Instead of ISOM you might for example use MP42, which is MP4 version 2 and does add a few things to the ISO base media file format, so different labels actually make sense.

These low-level MPEG4 Part 12 details can be easily manipulated using GPAC, which fortunately is available in Panda. Assuming that you’re already using raw neckbeard profiles, to change the ftyp of a file from ISOM to MP42 after it’s processed by FFmpeg, you could use following commands:

ffmpeg -i $input_file$ ... (your other FFmpeg arguments here) ... -y tmp.mp4
MP4Box -add tmp.mp4 -brand mp42 $output_file$

PS. Any time you’d like to use more than one command in a single Panda profile, join them either by ‘;’ or a newline.