douyi0219 2014-12-14 15:00
浏览 97
已采纳

使用Javascript或PHP更改视频的颜色类型

today i got 1 request from one of my client.

He wants to change color pattern of his video. He wants to convert his colorful video into "black & white", "sepia" , etc.,

Is it possible using javascript or PHP [PHP using any server software].

Thanks

  • 写回答

1条回答 默认 最新

  • doucou1892 2014-12-14 15:07
    关注

    It depends on many factors:

    • if the videos are hosted on youtube or another video service: No way to achieve that
    • if the videos are hosted on your server and are available via HTTP delivery you can use server side processing (ie when the videos are uploaded, you make a system call to a video tool like ffmpeg, or any other video processing tool) or use Javascript to process your video using canvas tag
    • if you are using a specialized streaming server, you can real-time process your videos but i don't think it's the case

    you can find several tutorials for video processing using JS (eg:http://html5doctor.com/video-canvas-magic/)

    for php (if you are using linux):

    <?php exec('/usr/bin/env ffmpeg -i input_video.mp4 -vf "hue=s=0" bw_video.mp4'); ?>
    

    It may take a long time (maybe more than max_execution_time), it may not work on shared hosting...

    If you don't care about the job is finished or not (and avoid max_execution_time problem):

    <?php exec('2>/dev/null 1>/dev/null /usr/bin/env ffmpeg -i input_video.mp4 -vf "hue=s=0" bw_video.mp4 &'); ?>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 组策略中的计算机配置策略无法下发
  • ¥15 如何绘制动力学系统的相图
  • ¥15 对接wps接口实现获取元数据
  • ¥20 给自己本科IT专业毕业的妹m找个实习工作
  • ¥15 用友U8:向一个无法连接的网络尝试了一个套接字操作,如何解决?
  • ¥30 我的代码按理说完成了模型的搭建、训练、验证测试等工作(标签-网络|关键词-变化检测)
  • ¥50 mac mini外接显示器 画质字体模糊
  • ¥15 TLS1.2协议通信解密
  • ¥40 图书信息管理系统程序编写
  • ¥20 Qcustomplot缩小曲线形状问题