热门标签 | 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


推荐阅读
  • iTOP4412开发板QtE5.7源码编译指南
    本文详细介绍了如何在iTOP4412开发板上编译QtE5.7源码,包括所需文件的位置、编译器设置、触摸库编译以及QtE5.7的完整编译流程。 ... [详细]
  • Asp.net MVC 中 Bundle 配置详解:合并与压缩 JS 和 CSS 文件
    本文深入探讨了 Asp.net MVC 中如何利用 Bundle 功能来合并和压缩 JavaScript 和 CSS 文件,提供了详细的配置步骤和示例代码,适合开发人员参考学习。 ... [详细]
  • YB02 防水车载GPS追踪器
    YB02防水车载GPS追踪器由Yuebiz科技有限公司设计生产,适用于车辆防盗、车队管理和实时追踪等多种场合。 ... [详细]
  • Java与JSON互转:实现JSON到Java对象及Java对象到JSON的转换
    本文详细介绍了如何在Java中实现JSON数据与Java对象之间的相互转换,包括代码示例和常见问题解决方法。 ... [详细]
  • 本文探讨了如何利用SqlDependency执行复杂的SQL查询,并确保在多线程环境下的安全性与效率。 ... [详细]
  • 本文详细介绍了ActivityManagerService (AMS) 的工作原理及其在Android系统中的重要角色。AMS作为system_server进程的一部分,在系统启动时加载,负责管理和协调应用程序中的Activity和服务(Service)。文章将通过具体的接口图和通信流程,帮助读者更好地理解AMS的工作机制。 ... [详细]
  • EasyMock实战指南
    本文介绍了如何使用EasyMock进行单元测试,特别是当测试对象的合作者依赖于外部资源或尚未实现时。通过具体的示例,展示了EasyMock在模拟对象行为方面的强大功能。 ... [详细]
  • 如何恢复CAD中意外丢失的图纸数据
    当使用CAD进行绘图时,因突然断电或其他原因导致计算机关闭可能会造成工作数据的丢失。然而,通过利用CAD软件的自动保存功能,用户通常能够恢复至最近一次自动保存的数据状态。 ... [详细]
  • 本文详细介绍了如何在现有的Android Studio项目中集成JNI(Java Native Interface),包括下载必要的NDK和构建工具,配置CMakeLists.txt文件,以及编写和调用JNI函数的具体步骤。 ... [详细]
  • 本文深入探讨 PHPCMS 平台中的字符串截取函数 str_cut 的使用方法,该函数常用于控制输出的标题或内容摘要长度,有效避免因过长的文本导致的页面布局问题。通过本文,读者将掌握如何灵活运用此函数,包括处理 HTML 标签等高级技巧。 ... [详细]
  • JavaWeb技术架构解析
    本文探讨了JavaWeb开发中客户端与服务器端的交互模式,重点分析了B/S(浏览器/服务器)和C/S(客户端/服务器)两种架构的特点及应用场景。 ... [详细]
  • 本文介绍了如何使用JavaScript和jQuery实现页面元素随着滚动条的移动而相应变化位置的功能,提供了一段简洁的代码示例。 ... [详细]
  • 无论是初学者还是经验丰富的开发者,W3CSchool都是一个不可或缺的资源库。本文将介绍几个关键的学习资源,帮助您提升网页开发技能。 ... [详细]
  • 本文深入探讨了JavaScript中实现继承的四种常见方法,包括原型链继承、构造函数继承、组合继承和寄生组合继承。对于正在学习或从事Web前端开发的技术人员来说,理解这些继承模式对于提高代码质量和维护性至关重要。 ... [详细]
  • 本文详细介绍了在使用Socket进行网络编程时,遇到链接器错误`undefined reference to WSAStartup@8`的解决方案,适用于多种开发环境。 ... [详细]
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社区 版权所有