热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

Flowplayerencoding

SOURCEURL:https:flowplayer.orgdocsencoding.htmlVideoencodingToeasethetaskofencodingyou

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,布布扣,bubuko.com


推荐阅读
  • Java验证码——kaptcha的使用配置及样式
    本文介绍了如何使用kaptcha库来实现Java验证码的配置和样式设置,包括pom.xml的依赖配置和web.xml中servlet的配置。 ... [详细]
  • 基于layUI的图片上传前预览功能的2种实现方式
    本文介绍了基于layUI的图片上传前预览功能的两种实现方式:一种是使用blob+FileReader,另一种是使用layUI自带的参数。通过选择文件后点击文件名,在页面中间弹窗内预览图片。其中,layUI自带的参数实现了图片预览功能。该功能依赖于layUI的上传模块,并使用了blob和FileReader来读取本地文件并获取图像的base64编码。点击文件名时会执行See()函数。摘要长度为169字。 ... [详细]
  • HDU 2372 El Dorado(DP)的最长上升子序列长度求解方法
    本文介绍了解决HDU 2372 El Dorado问题的一种动态规划方法,通过循环k的方式求解最长上升子序列的长度。具体实现过程包括初始化dp数组、读取数列、计算最长上升子序列长度等步骤。 ... [详细]
  • 本文讨论了Alink回归预测的不完善问题,指出目前主要针对Python做案例,对其他语言支持不足。同时介绍了pom.xml文件的基本结构和使用方法,以及Maven的相关知识。最后,对Alink回归预测的未来发展提出了期待。 ... [详细]
  • 本文讨论了如何优化解决hdu 1003 java题目的动态规划方法,通过分析加法规则和最大和的性质,提出了一种优化的思路。具体方法是,当从1加到n为负时,即sum(1,n)sum(n,s),可以继续加法计算。同时,还考虑了两种特殊情况:都是负数的情况和有0的情况。最后,通过使用Scanner类来获取输入数据。 ... [详细]
  • 本文介绍了OC学习笔记中的@property和@synthesize,包括属性的定义和合成的使用方法。通过示例代码详细讲解了@property和@synthesize的作用和用法。 ... [详细]
  • Mac OS 升级到11.2.2 Eclipse打不开了,报错Failed to create the Java Virtual Machine
    本文介绍了在Mac OS升级到11.2.2版本后,使用Eclipse打开时出现报错Failed to create the Java Virtual Machine的问题,并提供了解决方法。 ... [详细]
  • 本文讲述了作者通过点火测试男友的性格和承受能力,以考验婚姻问题。作者故意不安慰男友并再次点火,观察他的反应。这个行为是善意的玩人,旨在了解男友的性格和避免婚姻问题。 ... [详细]
  • 本文详细介绍了Linux中进程控制块PCBtask_struct结构体的结构和作用,包括进程状态、进程号、待处理信号、进程地址空间、调度标志、锁深度、基本时间片、调度策略以及内存管理信息等方面的内容。阅读本文可以更加深入地了解Linux进程管理的原理和机制。 ... [详细]
  • 1,关于死锁的理解死锁,我们可以简单的理解为是两个线程同时使用同一资源,两个线程又得不到相应的资源而造成永无相互等待的情况。 2,模拟死锁背景介绍:我们创建一个朋友 ... [详细]
  • 《数据结构》学习笔记3——串匹配算法性能评估
    本文主要讨论串匹配算法的性能评估,包括模式匹配、字符种类数量、算法复杂度等内容。通过借助C++中的头文件和库,可以实现对串的匹配操作。其中蛮力算法的复杂度为O(m*n),通过随机取出长度为m的子串作为模式P,在文本T中进行匹配,统计平均复杂度。对于成功和失败的匹配分别进行测试,分析其平均复杂度。详情请参考相关学习资源。 ... [详细]
  • 动态规划算法的基本步骤及最长递增子序列问题详解
    本文详细介绍了动态规划算法的基本步骤,包括划分阶段、选择状态、决策和状态转移方程,并以最长递增子序列问题为例进行了详细解析。动态规划算法的有效性依赖于问题本身所具有的最优子结构性质和子问题重叠性质。通过将子问题的解保存在一个表中,在以后尽可能多地利用这些子问题的解,从而提高算法的效率。 ... [详细]
  • 高质量SQL书写的30条建议
    本文提供了30条关于优化SQL的建议,包括避免使用select *,使用具体字段,以及使用limit 1等。这些建议是基于实际开发经验总结出来的,旨在帮助读者优化SQL查询。 ... [详细]
  • IhaveconfiguredanactionforaremotenotificationwhenitarrivestomyiOsapp.Iwanttwodiff ... [详细]
  • Java实战之电影在线观看系统的实现
    本文介绍了Java实战之电影在线观看系统的实现过程。首先对项目进行了简述,然后展示了系统的效果图。接着介绍了系统的核心代码,包括后台用户管理控制器、电影管理控制器和前台电影控制器。最后对项目的环境配置和使用的技术进行了说明,包括JSP、Spring、SpringMVC、MyBatis、html、css、JavaScript、JQuery、Ajax、layui和maven等。 ... [详细]
author-avatar
邵世以_806
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有