SOURCE URL: https://flowplayer.org/docs/encoding.html

Video encoding

To ease the task of encoding your original videos to the various formats we are building an online video platform on top of Amazon's infrastructure. Try the free version now!

Otherwise consider using one of the existing online platforms - like encoding.com or Zencoder - which offers the services that comply with your wishes.

For those determined not to delegate this task a few tips are to follow.

General advice

Always bear in mind that encoding for delivery over the wire differs fundamentally from encoding for a desktop viewing program. Your content has to pass through the needle hole of a connection whose speed is not under your control.

The results will and can only be a compromise between desired quality and delivery speed achieved by lossy compression. Moreover they will vary depending on the content of the original. A simple headshot is way more compression friendly than a movie containing high motion scenes and/or pan shots. You have to decide on which side of the scales you make more sacrifices, also in view of your target audience and the assumed speed of their connections.

  • Be extremely miserly about bitrate and dimensions! Downscaling is a waste of resources and often a video in the dimensions of the player container element on the page displays reasonably well in fullscreen too.
  • Encode to a constant frame rate. Variable frame rate will break playback in various scenarios, depending on engine, browser or platform.
  • If the input video is interlaced, you should apply a deinterlace filter.
  • If the input video does not have a sample ratio of 1/1 (square pixels), you must apply a filter enforcing a sample ratio of 1/1 because some versions of Internet Explorer cannot handle anamorphic MP4 and Flash is agnostic of display aspect ratio, knows only about width and height.

Assuming your original video has an aspect ratio of 16/9 and keeping the above caveats in mind you should aim for:

  • a resolution of 640x360 pixels
  • an average video bitrate between 400 and 1000 kilobits per second
  • an average audio bitrate between 40 and 80 kilobits per second

Take your time to try out various encoding settings on a small sample representative of your content. Good transcoding programs offer a constant quality switch. Try it and inspect the resulting bitrate. For the final encode use 2-pass encoding which distributes the bitrate better while keeping a good quality balance.

Codecs

MP4, WEBM and OGG are the containers for the following video and audio codecs:

Container video codec audio codec
MP4 H.264 aka MPEG-4 AVC or MPEG-4 Part 10 AAC
WEBM VP8 Vorbis
OGG Theora Vorbis

We did not cover the MPEG-4 Visual or MPEG-4 Part 2 video codec because it is not suitable as Flash fallback and will also not play in Internet Explorer in HTML5 mode. To avoid bad surprises encode to the more modern MPEG-4 AVC.

Ogg video

Unless you want to cover all your bases, consider omitting it. Except for a few corner cases concerning older browsers where you can failover to MP4 playback in Flash mode, either WEBM or MP4 will do the job as well, and better.

MP4 and metadata

H.264 encoded videos carry their metadata - duration, frame rate etc. - in the so called "moov atom".

By default encoding programs will insert the moov atom at the end of the video file which is suitable for playback of a local file in a desktop program. However, any kind of progressive download requires the metadata to be available right away for immediate playback. Otherwise the player has to wait for the entire video to be downloaded before playback starts.

Make sure to select an option in your transcoding program which puts the moov atom at the beginning of the file!

In case you already have a lot of MP4 videos with the moov atom at the end of the file, use a dedicated program such as QTIndexSwapper or MOOV Relocator to move it to the beginning.

MP4 for iOS and mobile devices

MPEG-4 AVC is a powerful codec which allows very effective compression at various profiles and levels. As higher profiles and levels are decoding intensive, they are not supported by mobile devices to ease their processor workload.

Let's take iOS as an example: Even the latest iPads will only play videos encoded at H.264 Main profile Level 3.1. But if you want to cater safely for the widest audience including viewers with iPhones and iPods and older iOS versions you should stick with:

  • Baseline Profile
  • Level 3.0
  • 1 reference frame
  • Resolution of maximum 640px width and maximum 480px height

Encoding samples

To give you an idea to what the above considerations lead we choose the commandline syntax of the FFmpeg program - there are also graphical frontends for FFmpeg, like Handbrake or ffmpegX (for Mac OS). There are many other transcoding programs around, and you should of course choose one you feel most comfortable with. Be aware though that often the quality of the program is directly proportional to its learning curve. It's also recommended to use the very latest version of the respective program because development in this area is moving fast.

In the following replace x in -pass x with 1 and 2 for the first and second pass/run respectively. We assume the original movie in.suffix has an aspect ratio of 16/9 and a frame rate of 25 frames per second.

WEBM encoding sample

ffmpeg -y -i in.suffix \
-filter:v scale=640:360,setsar=1/1 -pix_fmt yuv420p \
-vpre libvpx-720p -b:v 500k -r:v 25/1 -force_fps \
-c:a libvorbis -b:a 80k -pass x out.webm

MP4 encoding sample

ffmpeg -y -i in.suffix \
-filter:v scale=640:360,setsar=1/1 -pix_fmt yuv420p \
-c:v libx264 -preset:v slow -profile:v baseline \
-x264opts level=3.0:ref=1 -b:v 700k -r:v 25/1 -force_fps \
-movflags +faststart -c:a libfaac -b:a 80k -pass x out.mp4

Disclaimer: The above commandlines are very basic, and the syntax may differ in older FFmpeg versions. This cannot be the place for detailed information on how to handle the transcoding program(s) of your choice. Please consult the respective manuals, online documentation or mailing lists for in-depth advice regarding your transcoding software.

Flowplayer-encoding的更多相关文章

  1. javac -encoding utf8 in linux

    由于另外负责编码的同事用的是utf-8,我用的默认的编码格式gbk,在提交代码时,为了迁就他,我打算把格式用工具转成utf-8. 转化成果后,然后在make一下,发现javac -encoding u ...

  2. 创建Odoo8数据库时的“new encoding (UTF8) is incompatible with the encoding of the template database (SQL_ASCII)“问题

    Odoo8创建数据库时,显示如下错误信息: DataError: new encoding (UTF8) is incompatible with the encoding of the templa ...

  3. Node.js Base64 Encoding和Decoding

    如何在Node.js中encode一个字符串呢?是否也像在PHP中使用base64_encode()一样简单? 在Node.js中有许多encoding字符串的方法,而不用像在JavaScript中那 ...

  4. java Properties异常:Malformed \uxxxx encoding.

    昨天项目中遇到一个 java.lang.IllegalArgumentException: Malformed \uxxxx encoding.这样的一个异常,debug了一下发现是读取propert ...

  5. svn: Can't convert string from 'UTF-8' to native encoding 的解决办法(转)

    http://www.cnblogs.com/xuxm2007/archive/2010/10/26/1861223.html svn 版本库中有文件是以中文字符命名的,在 Linux 下 check ...

  6. C# 字符编码类Encoding

    在网络通信中,很多情况下都是将字符信息转成字节序列进行传输.将字符序列转为字节序列的过程称为编码.当这些字节传送到接收方,接收方需要逆向将字节序列转为字符序列.这个过程就是解码. 常见编码有ASCII ...

  7. 字符集和字符编码(Charset & Encoding)

    字符集和字符编码(Charset & Encoding)[转] 1.基础知识 计算机中储存的信息都是用二进制数表示的:而我们在屏幕上看到的英文.汉字等字符是二进制数转换之后的结果.通俗的说,按 ...

  8. 使用英文版eclipse保存代码,出现some characters cannot be mapped using "Cp1251" character encoding.

    some characters cannot be mapped using "Cp1251" character encoding. 解决办法:方案一: eclipse-> ...

  9. <?xml version="1.0" encoding="UTF-8"?> 的作用?

    version="1.0" 声明用的xml版本是1.0 encoding="UTF-8" 声明用xml传输数据的时候的字符编码,假如文档里面有中文,编码方式不是 ...

  10. 关于Unicode和URL encoding入门的一切以及注意事项

    本文同时也发表在我另一篇独立博客 <关于Unicode和URL encoding入门的一切以及注意事项>(管理员请注意!这两个都是我自己的原创博客!不要踢出首页!不是转载!已经误会三次了! ...

随机推荐

  1. Golden Gate 概念和机制

    1. OGG有哪些进程 ü  Manger : manger进程是goldengate的控制进程,分别运行在源端和目标端上,它主要的作用是启动.监控.重启goldengate的其他进程,报告错误及事件 ...

  2. 2016huas暑假集训训练题 G-Who's in the Middle

    题目链接:http://acm.hust.edu.cn/vjudge/contest/121192#problem/G 此题大意是给定一个数n 然后有n个数 要求求出其中位数  刚开始以为是按数学中的 ...

  3. 20145334实验三《敏捷开发与XP实践》

    实验内容 初步掌握单元测试和TDD 理解并掌握面向对象三要素:封装.继承.多态 初步掌握UML建模 熟悉S.O.L.I.D原则 了解设计模式 实验步骤 1.敏捷开发与XP 敏捷开发(Agile Dev ...

  4. 除了白名单外的IP每秒最多处理 8 个请求 limit_conn_zone

    防止黑客知道你的源服务器真实IP进行并发攻击,通常只需要保护动态文件请求,�php. 添加文件 nginx/conf/limit/whiteip.conf 里面是你要忽略限制的 白名单 IP地址,通常 ...

  5. Beta阶段站立会议-01

    组名:金州勇士 组长:尹良亮 组员:王汉斌.杜月.闫浩楠 代码地址: ssh:git@git.coding.net:handsomeman/examm.githttps://git.coding.ne ...

  6. ARM的一些基本概念

    MPU介绍: mpu是一个芯片,重力加速器(加速度)和陀螺仪(角速度) iic总线.在板上有iic控制器 连接着 最多128个外设,每个外设有地址,可以通信. 寄存器: cpu中的寄存器是为了加快运算 ...

  7. nginx的worker_processes,worker_cpu_affinity及worker_connections

    worker_processes:nginx要开启的进程数,一般为cpu的核数 worker_cpu_affinity:为每个进程绑定一个cpu,减少cpu切换的开销 配置示例: worker_pro ...

  8. [置顶] TortoiseGit和msysGit安装及使用笔记(windows下使用上传数据到GitHub)

    eclipse .MyEclipse 配置安装 git:http://wenku.baidu.com/link?url=gMT4a7K6EJWAztuwun73oPHiKqlydEdn5F3S2Win ...

  9. 移动表格行 解决低版本IE fadeIn fadeOut 失效问题

    在维护一个内部使用的web工具的时候,需要在表格里配置参数,并且支持参数列的上下移动,有jQuery-UI工具支持对表格列的拖动,但是此处不追求效果,而且旧系统页面兼容性很差,无奈只能做上下移动的按钮 ...

  10. angularJs非空校验requied

    <!DOCTYPE html><html><head><meta charset="utf-8"><title>< ...