剪切视频的小程序

使用微信小程序开发制作一个简易的视频编辑应用 以上代码只是一个简易的视频编辑应用,实际的视频编辑应用需要更多的功能和逻辑来实现。通过以上代码,我们已经实现了一个简易的视频编辑应用。用户可以在首页选择一个视频进行编辑,然后跳转到编辑页面,在编辑页面可以对视频进行剪辑、添加滤镜和添加音乐的操作。在剪辑功能中,我们可以使用video组件的bindplay、bindpause和bindended事件来监听视频的播放状态,然后根据需要对视频进行剪辑操作。在添加音乐功能中,可以使用audio组件来添加音乐,可以在addMusic方法中实现一个选择音乐的功能。 阅读详情

前几天需要把视频剪成5秒5秒的小段,手动剪显然太不靠谱,就写了个剪视屏的小程序。

先上程序:

#include "opencv.hpp"
#include "iostream"
using namespace cv;
using namespace std;


int main(int argc, char** argv)
{
    VideoCapture cap;    // 用于打开视频的类
    VideoWriter writer;    //用于写视频的类
    Mat frame;            // 暂存视频帧图像
    char c = NULL;
    string name1="E:\\1\\test.avi";    //原视频路径
    string name2="E:\\1\\1.avi";     //视频保存路径
    string tmp;        
    stringstream sstr;       //string流,用于把int转为string
    cap.open(name1);         //打开原视频

    int i=0,j=0;
    while(cap.isOpened())   //循环到视频最后一帧
    {
	if(i%145==0)    //每145帧存一个视频
	{
		j=i/145;     //新视频名,用数字命名
		sstr.str("");    //清空string流,不能用clear()
		sstr << j;       //int读入sstr
		tmp=sstr.str();  //.str()将int转为string
		name2="E:\\1\\"+tmp+".avi";   //新视频保存的完整路径
		writer.open(name2,CV_FOURCC('D', 'I', 'V', '3'), 25.0, Size(432, 240));  //打开写视频类
	}
	cap>>frame;      //视频帧流入
	writer << frame;  //视频帧写入
BF5-Clip-Sorter:整理BF5视频剪辑的小程序 BF5-Clip-Sorter 整理BF5视频剪辑的小程序 立即下载

相关推荐

ifilmedit视频剪辑软件

视频剪辑软件,相信玩视频编辑的朋友对其是再熟悉不过了

曼格短视频小程序1.7.6 完整源码包+小程序前端

【新增】视频分类支持清空视频操作 【新增】视频分佣视频列表标题支持长按复制操作 【新增】某个视频可单独指定自定义推广替代全局流量主广告 【新增】用户推广新增免费用户权限设置,更细致的权限管理,可用于调整免费用户可使用的功能 【修复】修复视频分佣播放页banner广告失效问题 【修复】修复视频分佣生成的链接可能存在错位的问题 【修复】修复视频分佣链接每日可生成数量限制显示不准确的问题 【修复】修复视频分佣昨日收益显示不正确的问题 【优化】优化视频分佣奖励领取记录的显示 【优化】优化微视专辑多页采集只能采集250个的问题 【优化】优化视频分佣功能需要授权登录后才能使用 【优化】点击头像或昵称可进入个人信息编辑页面 【优化】优化视频流列表的显示 *本次更新需上传小程序端

Zemax非序列模式新手入门:从零搭建一个抛物面反射镜系统(含灯丝光源与探测器设置)

本文详细介绍了如何在Zemax非序列模式下从零搭建抛物面反射镜系统,包括灯丝光源配置、反射镜建模和探测器设置等关键步骤。通过实战指南,帮助光学设计新手快速掌握非序列模式的应用技巧,特别适合处理复杂光线传播场景如反射镜系统和杂散光分析。

weixin_28717431的博客 436

EtherCAT-1 技术概述

1.EtherCAT简介①开放的技术EtherCAT全称EtherNet Control Automation Technology,是由德国倍福(Beckhoff)公司提出的一种实时以太网技术。EtherCAT是一种开放但不开源的技术,意味着您可以任意使用这项技术,但若要进行相关设备的开发,则需要向倍福公司获取相关授权。②快速性相比传统现场总线,EtherCAT的数据传输速率有了极大的提升,可选10Mbit/s或100Mbit/s,甚至依托补充

tianya_xuan的博客 3543

立创开源桌面激光雕刻机DIY全解析:从悬臂结构、Arduino主控到Marlin固件

本文详细解析了基于立创开源平台的桌面激光雕刻机DIY全过程。重点介绍了悬臂式机械结构的设计与优化,阐述了采用Arduino Mega 2560主控与RAMPS 1.4扩展板的经典控制方案,并深入讲解了Marlin固件的关键配置步骤,包括电机步数计算与激光功能启用,为创客和电子爱好者提供了一套完整的从硬件搭建到软件调试的实战指南。

weixin_42510201的博客 383

快速理解STLink引脚图中复位引脚作用

深入讲解STLink引脚图中复位引脚的实际用途,帮助开发者快速掌握其在调试与下载过程中的关键作用,结合stlink引脚图理解更高效。

weixin_32324637的博客 1326

地磁场仿真与导航方案设计

地磁场仿真与导航方案设计 地磁场作为地球的固有资源,为航空、航天、航海提供了天然的坐标,可应用于航天器、航空飞行器和舰船等载体的定位、定向及姿态控制。本文依据地磁场的球谐模型,利用Matlab工具,设计了计算任意地点地磁场的程序,对仿真结果与实际数据进行对比分析;并选定一组卫星的数据,结合卫星的运动轨道,描绘90分钟内卫星处地磁总强度/矢量随轨道变化曲线,据此设计一种卫星地磁导航方案。 一、地磁场计算原理 1.1.球谐模型与球谐系数 地磁学的基本问题之一就是用数学表达式将地磁要素的地面分布表示成地理坐标的函

PRQKKK的博客 7408

Tessent ATPG Flow 流程 (代码和注释)

**摘要:Tessent ATPG流程分为五个阶段:1) 环境初始化(加载设计文件、库和扫描链配置);2) DRC规则检查(验证设计可测试性并修复违例);3) ATPG向量生成(设置故障模型并运行引擎优化覆盖率);4) 向量验证与后处理(仿真验证并生成ATE格式文件);5) 进阶操作(多电压域和存储器测试)。流程输出包括测试向量、覆盖率报告和验证日志,支持stuck-at和transition故障模型,使用Tcl脚本控制。关键步骤包含扫描链配置、EDT压缩和覆盖率优化。

QQ_778132974的博客 930

低照度与极端天气环境中的YOLOv8优化:CPA-Enhancer网络的应用与分析

为了克服上述问题,本文提出了一种名为的网络改进方案。CPA-Enhancer通过引入链式思考机制和改进的注意力机制,有效地提升了YOLOv8在低照度和复杂天气下的表现。本文提出了针对低照度和恶劣天气条件下目标检测的YOLOv8改进方案——CPA-Enhancer链式思考网络。通过引入低照度图像增强和多尺度特征融合技术,CPA-Enhancer显著提高了YOLOv8在低光照、雾霾、雨雪等环境下的检测性能。实验结果表明,CPA-Enhancer相较于原始YOLOv8,在多个指标上都有显著的提升,尤其是在mAP。

博客 1564

算法 | 基于灰狼优化算法的无人机三维路径规划方法研究(附matlab代码)

针对复杂环境下的无人机三维路径规划问题,本文提出一种基于灰狼优化算法(Grey Wolf Optimizer, GWO)的解决方案。通过模拟灰狼群体的社会等级与协作捕猎机制,结合动态参数调整策略,优化路径长度与避障性能。实验表明,相较于粒子群优化(PSO)和遗传算法(GA),GWO算法在收敛速度与路径成本上分别提升约25%和18%,且在三维城市地形中表现出更强的避障鲁棒性。本文提供完整的MATLAB代码实现,为无人机自主导航提供理论与技术支撑。

尘世冰封的专栏 287

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

IDEA的使用指南

IDEA基于java的使用手册,可以最快速的上手,在使用中不断的丰富自己的使用技巧.

霍尼韦尔SoftMaster使用说明

霍尼韦尔SoftMaster使用说明

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

上一篇: 视频播放程序改良
下一篇: 文件夹下一类文件重命名
hellofuturecyj
博客等级 码龄16年 3粉丝 22原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值