电脑上mp4视频文件无缩略图怎么办

前言:有时候电脑重装后电脑上的mp4视频文件无缩略图,视频文件数量比较多的时候查找比较麻烦
以下方法亲测有效:
1、下载MediaPreview软件
2、软件链接地址:https://pan.baidu.com/s/1bzVJpmcHyGxXNjnzltojtQ?pwd=pma0
提取码:pma0
在这里插入图片描述

在这里插入图片描述
设置好后,mp4视频文件就有缩略图了,没有的话重启一下电脑就有了,大家快去试试吧。

  • 12
    点赞
  • 9
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
可以使用以下步骤从mp4视频文件中提取帧缩略图: 1. 使用MediaExtractor从mp4文件中提取视频轨道数据。 ```java MediaExtractor extractor = new MediaExtractor(); extractor.setDataSource(filePath); int trackCount = extractor.getTrackCount(); for (int i = 0; i < trackCount; i++) { MediaFormat format = extractor.getTrackFormat(i); String mime = format.getString(MediaFormat.KEY_MIME); if (mime.startsWith("video/")) { extractor.selectTrack(i); ByteBuffer inputBuffer = ByteBuffer.allocate(1024 * 1024); MediaCodec codec = MediaCodec.createDecoderByType(mime); codec.configure(format, null, null, 0); codec.start(); boolean isEOS = false; while (!isEOS) { int sampleSize = extractor.readSampleData(inputBuffer, 0); if (sampleSize < 0) { isEOS = true; } else { long presentationTimeUs = extractor.getSampleTime(); codec.queueInputBuffer(inputBuffer.position(), sampleSize, presentationTimeUs, 0, isEOS ? MediaCodec.BUFFER_FLAG_END_OF_STREAM : 0); extractor.advance(); } MediaCodec.BufferInfo bufferInfo = new MediaCodec.BufferInfo(); int outputBufferIndex = codec.dequeueOutputBuffer(bufferInfo, TIMEOUT_US); while (outputBufferIndex >= 0) { Image image = codec.getOutputImage(outputBufferIndex); // 处理image,生成缩略图 codec.releaseOutputBuffer(outputBufferIndex, true); outputBufferIndex = codec.dequeueOutputBuffer(bufferInfo, TIMEOUT_US); } } codec.stop(); codec.release(); extractor.unselectTrack(i); } } extractor.release(); ``` 2. 使用MediaCodec进行视频解码,获取每一帧的Image对象。 3. 将Image对象转换为Bitmap对象,生成缩略图。 ```java Image.Plane[] planes = image.getPlanes(); ByteBuffer buffer = planes[0].getBuffer(); int pixelStride = planes[0].getPixelStride(); int rowStride = planes[0].getRowStride(); int rowPadding = rowStride - pixelStride * width; Bitmap bitmap = Bitmap.createBitmap(width + rowPadding / pixelStride, height, Bitmap.Config.ARGB_8888); bitmap.copyPixelsFromBuffer(buffer); bitmap = Bitmap.createBitmap(bitmap, 0, 0, width, height); ``` 4. 可以使用OpenGL对缩略图进行后期处理,如旋转、缩放等操作。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值