首页 文章 精选 留言 我的

精选列表

搜索[云真机],共10000篇文章
优秀的个人博客,低调大师

实现海康/宇视NVR硬盘录像机/IPC摄像机监控历史回放录像rstp流视频的倍数下载

**该工具类实现基于多线程的RTSP回放视频下载,支持倍速播放(1/2/4/8/16/32倍),通过时间切片并行下载,自动合并分片文件。兼容海康、宇视等主流NVR设备,利用FFmpeg进行音视频处理,支持指定起止时间与线程数,具备断点续传、异常重试及临时缓存清理机制,确保高效稳定下载高质量回放视频。** ```java import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; import java.io.*; import java.time.Duration; import java.time.LocalDateTime; import java.time.ZoneId; import java.time.ZoneOffset; import java.time.format.DateTimeFormatter; import java.util.ArrayList; import java.util.Comparator; import java.util.List; import java.util.UUID; import java.util.concurrent.*; import static cn.iocoder.yudao.module.wvp.utils.RtspSignalClient.*; @Slf4j public class RtspScaleReplayDownloader { private static final boolean NEED_AUDIO = true; public static final boolean DEBUG = false; private static final String FFMPEG_PATH = "ffmpeg"; private static final String OUTPUT_DIR = "./rtsp_download"; private static final long FFMPEG_WAIT_FOR_TIME = 1; private static final int DELETE_FILE_TRY_TIME = 3; private static final long DELETE_FILE_RETRY_DELAY = 200; private static final DateTimeFormatter INPUT_FORMAT = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); private static final DateTimeFormatter RTSP_TIME_FORMAT = DateTimeFormatter.ofPattern("yyyyMMdd'T'HHmmss'Z'"); /** * 支持的 Scale 倍速(2 的幂次方) * * RTSP 协议本身允许任意浮点数,但主流 NVR 只支持 2 的幂次方。 * * 宇视:支持 1/2/4/8/16/32(实测 32 报 500,实际上限 16) * 海康:仅支持 1/2/4(实测可支持16) * */ private static final double[] SUPPORTED_SCALES = {1.0, 2.0, 4.0, 8.0, 16.0, 32.0}; static { File file = new File(OUTPUT_DIR); showInfoLog("开始清理生成回放视频缓存文件夹: %s", file.getAbsolutePath()); if (file.exists()) { delFolder(file.getAbsolutePath()); } } /** * 主码流非常清晰,但是实测海康白天的视频大小比子码流大7倍左右 */ public static File downloadReplayByMultiThreadWithScale(RtspSignalClient.RtspDeviceConfig rtspDeviceConfig, String rtspUri, String startTimeStr, String endTimeStr, int threadCount, double pushStreamScale, String mp4FileName) throws Exception { //校验 validate(rtspDeviceConfig, threadCount, pushStreamScale); long start = System.currentTimeMillis(); LocalDateTime startTime = LocalDateTime.parse(startTimeStr, INPUT_FORMAT); LocalDateTime endTime = LocalDateTime.parse(endTimeStr, INPUT_FORMAT); //【海康的每个信令调用都要带上starttime、endtime (且是北京时间时区) 否则报超时、如果时间范围内没有数据,也会报超时】 if (VideoBrandTypeEnum.HIKVISION.equals(rtspDeviceConfig.getBrand())) { rtspUri += "?starttime=" + startTime.format(RTSP_TIME_FORMAT) + "&endtime=" + endTime.format(RTSP_TIME_FORMAT); } // 动态计算总时长(秒,保留毫秒精度用于后续裁剪) double totalSeconds = Duration.between(startTime, endTime).toMillis() / 1000.0; //完全可以作为处理文件的临时文件夹,(这里需要建个子文件夹。考虑同时多个下载任务) String timestamp = LocalDateTime.now() .format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss_")); String tempDir = DEBUG ? OUTPUT_DIR : OUTPUT_DIR + File.separator + timestamp + UUID.randomUUID().toString().toLowerCase(); File dir = new File(tempDir); List> futures = new ArrayList<>(); // 2. 多线程下载 ExecutorService executor = Executors.newFixedThreadPool(threadCount); CompletionService completionService = new ExecutorCompletionService<>(executor); try { if (!dir.exists()) { dir.mkdirs(); } // 1. 毫秒级均匀切片 List slices = splitTime(startTime, endTime, threadCount); showInfoLog("倍数下载配置:线程数:%s,推流倍数:%s", threadCount, pushStreamScale); showInfoLog("===== 时间切片方案(毫秒级均匀)====="); for (int i = 0; i future = completionService.submit(() -> { downloadAndTrimSlice(rtspDeviceConfig, finalRtspUri, slice, outputFile, index, pushStreamScale); return outputFile; }); futures.add(future); } // 3. 等待所有分片完成 List parts = new ArrayList<>(); for (int i = 0; i f = completionService.take(); // 任意一个失败会立刻抛异常 parts.add(f.get()); } // 4. 合并(用动态总时长兜底截断) // 按文件名里的 index 排序,确保合并顺序正确 // 文件名格式:part_1.mp4, part_2.mp4, ... parts.sort(Comparator.comparingInt(f -> { String name = f.getName(); // part_1.mp4 String num = name.replaceAll("\\D+", ""); // 1 return Integer.parseInt(num); })); File finalFile = new File(dir, mp4FileName); mergeMp4(parts, finalFile, totalSeconds); String cleanPath = finalFile.toPath().normalize().toAbsolutePath().toString(); showInfoLog("✅ 完成:%s,%.3f秒耗时:%s", cleanPath, totalSeconds, getCostTimeString(start)); //清理临时文件,保留最终结果文件 cleanTempFiles(dir); return finalFile; } catch (Exception e) { showErrorLog("下载出现异常:%s", e.getMessage()); for (Future f : futures) { if (!f.isDone()) { f.cancel(true); } } //全部删除 delFolder(dir.getAbsolutePath()); //调用层处理业务逻辑 throw e; } finally { // 先尝试正常关闭,等 1 秒,如果还有任务就跑 shutdownNow executor.shutdown(); try { if (!executor.awaitTermination(1, TimeUnit.SECONDS)) { executor.shutdownNow(); } } catch (InterruptedException e) { executor.shutdownNow(); Thread.currentThread().interrupt(); } } } public static boolean isFfmpegInstalled(String toolName) { ShellExecUtil.CommandResult ret = ShellExecUtil.isWindows()? ShellExecUtil.executeSafe(3, "cmd", "/c", "where "+toolName): ShellExecUtil.executeSafe(3, "sh", "-c", "command -v "+toolName); // 退出码 + 输出 同时判断 if (ret.isSuccess() && StringUtils.isNotBlank(ret.getOutput())) { log.info( "{} 已就绪,路径: {}", toolName , ret.getOutput().trim()); return true; } return false; } /** * 毫秒级均匀切片 * 把 [start, end] 分成 count 份,每份时长 = totalMillis / count 毫秒 * 最后一份兜底覆盖所有剩余毫秒,确保首尾相接无遗漏 */ private static List splitTime(LocalDateTime start, LocalDateTime end, int count) { List list = new ArrayList<>(); long totalMillis = Duration.between(start, end).toMillis(); long perSliceMillis = totalMillis / count; for (int i = 0; i RTSP Range 的 UTC 格式(秒级) * 注意:RTSP clock 格式只支持到秒,毫秒会被向下取整 */ private static String toUtc(LocalDateTime beijingTime) { LocalDateTime utc = beijingTime .atZone(ZoneId.of("Asia/Shanghai")) .withZoneSameInstant(ZoneOffset.UTC) .toLocalDateTime(); // 向下取整到秒(丢弃毫秒/纳秒部分) utc = utc.withNano(0); return utc.format(RTSP_TIME_FORMAT); } /** * 合并所有分片为最终的 MP4 * * @param parts 分片文件列表 * @param output 最终输出文件 * @param totalSeconds 动态总时长(用于兜底截断) */ private static void mergeMp4(List parts, File output, double totalSeconds) throws Exception { File listFile = new File(OUTPUT_DIR, "concat_list.txt"); try (PrintWriter pw = new PrintWriter(listFile)) { for (File f : parts) { pw.println("file '" + f.getAbsolutePath().replace("\\", "/") + "'"); } } ProcessBuilder pb = new ProcessBuilder( FFMPEG_PATH, "-fflags", "+genpts", "-f", "concat", "-safe", "0", "-i", listFile.getAbsolutePath(), "-t", String.format("%.3f", totalSeconds), //动态总时长兜底 "-c", "copy", "-y", output.getAbsolutePath() ); pb.redirectErrorStream(true); Process p = pb.start(); try (BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()))) { String line; while ((line = br.readLine()) != null) { if (line.contains("Output") || line.contains("Error") || line.contains("frame=")) { showInfoLog("[合并] " + line); } } } // 提取公共方法:等待进程结束(带超时 + 强制终止) waitForProcess(p, "MP4 合并"); } /** * 时间切片对象(含目标时长,用于后续裁剪) */ static class TimeSlice { LocalDateTime start; LocalDateTime end; double targetSeconds; TimeSlice(LocalDateTime s, LocalDateTime e, double target) { this.start = s; this.end = e; this.targetSeconds = target; } } //新增:带音频下载路径(NEED_AUDIO=true 时才会进入) // 显式回退:检测到 NVR 无音频时,直接调用原 downloadAndTrimSlice 走纯视频路径 //新增:带音频下载路径(NEED_AUDIO=true 时才会进入) // 显式回退:检测到 NVR 无音频时,直接调用 downloadPureVideo 走纯视频路径 private static void downloadAndTrimSliceWithAudio(RtspSignalClient.RtspDeviceConfig rtspDeviceConfig, String rtspUri, TimeSlice slice, File outputFile, int index, double pushStreamScale) throws Exception { String rangeStart = toUtc(slice.start); String rangeEnd = toUtc(slice.end); // 关键修复:海康场景,用切片自己的时间覆盖 URL 的 starttime/endtime // 与 downloadPureVideo 保持一致,否则 4 个分片共用全局 URL,海康会推到全局 endtime if (VideoBrandTypeEnum.HIKVISION.equals(rtspDeviceConfig.getBrand())) { rangeStart = slice.start.format(RTSP_TIME_FORMAT); rangeEnd = slice.end.format(RTSP_TIME_FORMAT); rtspUri = rtspUri.replaceAll("starttime=[^&]*", "starttime=" + rangeStart) .replaceAll("endtime=[^&]*", "endtime=" + rangeEnd); showInfoLog("[线程%d] 海康切片(音频): %s ~ %s (目标 %.3f 秒)", index, rangeStart, rangeEnd, slice.targetSeconds); } showInfoLog("[线程%d] 开始(音频): %s ~ %s (目标 %.3f 秒)", index, rangeStart, rangeEnd, slice.targetSeconds); RtspSignalClient client = new RtspSignalClient(rtspDeviceConfig.getHost(), rtspDeviceConfig.getPort(), rtspDeviceConfig.getUsername(), rtspDeviceConfig.getPassword(), rtspUri, true); //海康专属优化 —— 音频路径也用时长预算 // 宇视场景:IS_HIKVISION=false,不调用 setMaxReceiveSeconds,行为与之前一字不差 if (VideoBrandTypeEnum.HIKVISION.equals(rtspDeviceConfig.getBrand())) { double maxSeconds = slice.targetSeconds + 3.0; client.setMaxReceiveSeconds(maxSeconds); showInfoLog("[线程%d] 海康模式(音频):设置时长预算 %.3f 秒", index, maxSeconds); } client.connectAndProbe(); //显式回退:NVR 不推音频时,直接走纯视频路径(绕开 NEED_AUDIO 判断,避免递归) if (!client.isAudioAvailable()) { showInfoLog("[线程%d] 无音频,回退到纯视频路径", index); client.stop(); downloadPureVideo(rtspDeviceConfig, rtspUri, slice, outputFile, index, pushStreamScale); return; } String codec = client.getVideoCodec(); String codecParam = "H265".equals(codec) ? "hevc" : "h264"; showInfoLog("[线程" + index + "] 编码格式: " + codec + ",音频可用: " + client.isAudioAvailable()); File rawFile = new File(outputFile.getParent(), "raw_" + index + ".mp4"); File videoTmp = new File(outputFile.getParent(), "video_" + index + ".tmp"); File audioTmp = new File(outputFile.getParent(), "audio_" + index + ".pcm"); // 阶段 1:拉流,视频/音频分别落临时文件 try (OutputStream videoOut = new FileOutputStream(videoTmp); OutputStream audioOut = new FileOutputStream(audioTmp)) { client.play(rangeStart, rangeEnd, videoOut, audioOut, pushStreamScale); } showInfoLog("[线程%d] 拉流完成,开始封装 MP4", index); try { // 阶段 2:FFmpeg 合并视频+音频 String audioFormat = "PCMU".equals(client.getAudioCodec()) ? "mulaw" : "alaw"; ProcessBuilder pb = new ProcessBuilder( FFMPEG_PATH, "-fflags", "+genpts+discardcorrupt", "-analyzeduration", "10000000", "-probesize", "10000000", "-f", codecParam, "-i", videoTmp.getAbsolutePath(), "-f", audioFormat, "-ar", "8000", "-ac", "1", "-t", String.format("%.3f", slice.targetSeconds + 3.0), "-i", audioTmp.getAbsolutePath(), "-map", "0:v", "-map", "1:a", "-c:v", "copy", "-c:a", "aac", // 关键修复:音频 PTS 整体 +0.128,对齐视频的 0.128 // asetpts 是音频版的 setpts,TB 是时间基 "-af", "asetpts=PTS+0.128/TB", "-t", String.format("%.3f", slice.targetSeconds + 3.0), "-movflags", "+faststart", "-y", rawFile.getAbsolutePath() ); pb.redirectErrorStream(true); Process ffmpeg = pb.start(); // 提取公共方法:启动日志读取线程 startFfmpegLogThread(ffmpeg, "FFmpeg-audio-" + index); // 提取公共方法:等待进程结束(带超时 + 强制终止) waitForProcess(ffmpeg, "FFmpeg 音频封装"); // 阶段 3:裁剪到精确时长 double trimSeconds = slice.targetSeconds + 0.05; trimSlice(rawFile, outputFile, trimSeconds, index); showInfoLog("[线程%d] 完成: %s (%d KB, 音频包 %d)", index, outputFile.getName(), outputFile.length() / 1024, client.getAudioReceivedPackets()); } catch (Exception e) { showInfoLog("[线程%d] 异常: %s (%d KB, 音频包 %d)", index, outputFile.getName(), outputFile.length() / 1024, client.getAudioReceivedPackets()); throw e; } finally { // 删除原始文件 if (!deleteFileWithRetry(videoTmp, DELETE_FILE_TRY_TIME, DELETE_FILE_RETRY_DELAY)) { showErrorLog("[线程" + index + "] 删除临时文件失败: " + videoTmp); } if (!deleteFileWithRetry(audioTmp, DELETE_FILE_TRY_TIME, DELETE_FILE_RETRY_DELAY)) { showErrorLog("[线程" + index + "] 删除临时文件失败: " + audioTmp); } if (!deleteFileWithRetry(rawFile, DELETE_FILE_TRY_TIME, DELETE_FILE_RETRY_DELAY)) { showErrorLog("[线程" + index + "] 删除临时文件失败: " + rawFile); } } } /** * 删除指定文件夹下的所有文件,不包括当前自身第一级的文件夹 * * @param path 路径 * @return 完成标识 */ private static boolean delAllFile(String path) { if (path == null || path.isBlank()) { return true; } boolean flag = false; File file = new File(path); if (!file.exists()) { return flag; } if (!file.isDirectory()) { return flag; } // 有多级文件夹,但是文件夹都没有文件的情况,先执行下删除,这个只会删除掉最后一级的文件夹 // 如果文件别占用似乎不会提示,可以通过 deleteFileByWalkFileTree(folderPath); 临时检测一下 file.delete(); String[] tempList = file.list(); File temp = null; if (tempList != null) { for (String p : tempList) { if (path.endsWith(File.separator)) { temp = new File(path + p); } else { temp = new File(path + File.separator + p); } if (temp.isFile()) { temp.delete(); } if (temp.isDirectory()) { //先删除文件夹里面的文件 delAllFile(path + "/" + p); //再删除空文件夹 delFolder(path + "/" + p); flag = true; } } } return flag; } /** * 清理临时文件,保留最终结果文件 * 清理中间产生的临时文件(raw_*.mp4, trimmed_*.mp4, concat_list.txt) */ private static void cleanTempFiles(File dir) { File[] files = dir.listFiles(); if (files == null) return; for (File f : files) { String name = f.getName(); if (name.startsWith("raw_") || name.startsWith("part_") || name.equals("concat_list.txt")) { if (f.delete()) { RtspSignalClient.showDebugLog("[清理文件] " + name); } else { showErrorLog("[清理文件失败] " + name); } } } } /** * 删除文件夹 ,包括当前自身第一级的文件假 * * @param folderPath 文件夹 */ private static void delFolder(String folderPath) { // deleteFileByWalkFileTree(folderPath); try { if (folderPath == null || folderPath.isBlank()) { return; } // 删除完里面所有内容 delAllFile(folderPath); File myFilePath = new File(folderPath); // 删除空文件夹 myFilePath.delete(); } catch (Exception e) { showErrorLog("delFolder 删除文件夹出现异常,路径:{}, 异常:%s", folderPath, e); } } /** * 删除文件(带重试) * * Windows 下 FFmpeg 进程退出后,文件句柄释放有延迟,需要重试几次。 * * @param file 要删除的文件 * @param maxRetry 最大重试次数 * @param retryDelay 重试间隔(毫秒) * @return 是否删除成功 */ private static boolean deleteFileWithRetry(File file, int maxRetry, long retryDelay) { if (file == null || !file.exists()) { return true; } for (int i = 0; i 本次重构新增:原代码在 2 处(downloadPureVideo、downloadAndTrimSliceWithAudio) * 存在几乎相同的日志读取线程启动逻辑,现统一提取到此方法。 * * @param ffmpeg FFmpeg 进程 * @param tag 日志标签前缀(如 "FFmpeg-1"、"FFmpeg-audio-1") */ private static void startFfmpegLogThread(Process ffmpeg, String tag) { Thread logThread = new Thread(() -> { try (BufferedReader br = new BufferedReader(new InputStreamReader(ffmpeg.getInputStream()))) { String line; while ((line = br.readLine()) != null) { // 支持外部中断:多线程场景下,一个分片失败,其他分片应立即停止 if (Thread.currentThread().isInterrupted()) { showInfoLog("[" + tag + "] 收到中断信号,停止读取日志"); break; } if (line.contains("frame=") || line.contains("Error") || line.contains("error")) { //RtspSignalClient.showDebugLog("[" + tag + "] " + line); } } } catch (Exception ignored) { } }); logThread.setDaemon(true); logThread.start(); } /** * 校验 pushStreamScale,不合法抛异常 * * @param rtspDeviceConfig * @param pushStreamScale * @throws IllegalArgumentException 不合法时抛出 */ private static void validate(RtspDeviceConfig rtspDeviceConfig, int threadCount, double pushStreamScale) { //判断ffmpeg : boolean ffmpegInstalled = isFfmpegInstalled("ffmpeg"); if (!ffmpegInstalled) { throw ServiceExceptionUtil.businessException("未安装ffmpeg"); } if (threadCount > 1) { showInfoLog("不推荐多线程分片下载,合并相邻视频会有跳跃"); } if (!isValidScale(pushStreamScale)) { throw ServiceExceptionUtil.businessException( "非法的 pushStreamScale: " + pushStreamScale + ",仅支持: 1/2/4/8/16/32"); } if (VideoBrandTypeEnum.UNIVIEW.equals(rtspDeviceConfig.getBrand())) { if (pushStreamScale > 32) { throw ServiceExceptionUtil.businessException("宇视的推流倍数不推荐超过32倍(最多实际支持16倍)"); } } if (VideoBrandTypeEnum.HIKVISION.equals(rtspDeviceConfig.getBrand())) { if (pushStreamScale > 16) { throw ServiceExceptionUtil.businessException("海康的推流倍数不推荐超过16倍"); } } } /** * 校验 pushStreamScale 是否合法 * * @param scale 倍速值 * @return true=合法 */ private static boolean isValidScale(double scale) { for (double s : SUPPORTED_SCALES) { if (Math.abs(s - scale) < 0.001) { // 浮点数比较用 epsilon return true; } } return false; } /** * 计算任务消费的时间 */ public static String getCostTimeString(long startTime) { long endTime = System.currentTimeMillis(); long ms = endTime - startTime; long hour = ms / 1000 / 60 / 60; long min = ms / 1000 / 60 % 60; long sec = ms / 1000 % 60; long mi = ms % 1000; return hour + "时 " + min + "分 " + sec + "秒 " + mi + "毫秒"; } } ```

优秀的个人博客,低调大师

#WorkBuddy# 实战:5 个月自媒体数据复盘,我找到了流量暴跌的真因

## 一、播放从 4.2 万掉到 800,我快放弃了 我是农民工,学电脑才一年,去年才开始用 Mac。白天在工地,晚上回家拍几条 Mac 技巧视频,抖音、快手、头条、B 站、小红书、视频号,6 个平台一起发。 6 月是我最好的一月,抖音跑了 4.2 万播放,单条最高 5228。我以为路子走对了。 然后 7 月掉到 6200,8 月 2700,9 月只剩 800。 我干的第一件事是瞎猜:是不是被限流了?是不是标签打错了?是不是封面太丑?封面换了、标签换了、发布时间也换了,一点用没有。 后来才想明白:**我不是缺流量,我是缺从数据里找规律的能力。** 我盯着那些表格,只看到一堆数字,看不出哪一个是关键。 ## 二、我把数据整理成表,喂给了 WorkBuddy ![](https://developer.qcloudimg.com/http-save/yehe-12758281/c547a987e198d2ba7175ccbd699583d3.png) ![](https://developer.qcloudimg.com/http-save/yehe-12758281/c41bdb15113bde19375dfce5d76fc819.png) 我把 4 月到 9 月的发布记录整理成一张表,字段只留 6 个:发布日期、平台、主题、时长、播放量、互动量。 然后用 WorkBuddy 打开这张表,问了一个很直白的问题: ![](https://developer.qcloudimg.com/http-save/yehe-12758281/685e04a94fa2a99e40dc9d2dcf58781f.png) 注意我问的方式——**我没让它"给点建议",我让它指认具体哪几条。** 泛泛的建议没有用,我要知道"6 月 24 日那条 42 秒的为什么行,9 月那条 1 分 40 秒的为什么不行"。 ## 三、它第一条结论就把我钉住了 ![](https://developer.qcloudimg.com/http-save/yehe-12758281/797e5ff4597f807262de5e45770ec167.png) 它列完对比,第一句是: > 你 6 月能爆,不是因为选题好,是因为时长短。 我不服气,去翻数据: | 日期 | 平台 | 标题 | 时长 | 播放 | |---|---|---|---|---| | 6/24 | 抖音 | 桌面太乱,滑一下就好 | 42 秒 | 5228 | | 6/22 | 抖音 | 底栏三步整理 | 27 秒 | 3806 | | 6/29 | 抖音 | 那个尴尬瞬间 | 19 秒 | 2372 | | 9/6 | 抖音 | Mac 这 4 个免费 App | 1 分 22 秒 | 245 | | 9/4 | 快手 | 用了半年 Mac 才发现在用最笨的方法 | 57 秒 | 33 | 上面三条 20–40 秒的,播放都是几千;下面两条 1 分多钟的,播放只有 33 和 245。 **时长一拉长,播放就掉。** 8、9 月的低谷,全是 1 分 10 秒到 1 分 49 秒的,播放只有 50 到 312。 我之前一直以为是内容不行,其实是别人根本看不到我内容的结尾。 ## 四、它给的另外 4 条结论 1. **两个平台脾气不一样。** 抖音吃"操作演示",看完能照着做;快手吃"经验观点",避坑、真实体验、花了冤枉钱这类。我快手播放最高的是"Windows 换 Mac 值不值"4046、"一直插电对不对"2212,全是观点类。 1. **我踩过限流雷区。** 画面里出现第三方软件、下载、安装、传文件,播放会被压。我自己有记录:一条分屏视频没打码,1661 掉到 16;一条"下载的软件打不开"只有 330。 1. **标题有公式。** 爆款基本是「痛点场景 + 问号 + 一个动作」——乱、烦、找不到开头,滑一下、三步、一键收尾。 1. **别在 6 个平台平均用力。** 头条和 B 站基本不出量,视频号稳定 100–350 不爆发,真正的主战场只有抖音和快手。 ## 五、我照着改了两件事 **第一件:把视频压短。** ![](https://developer.qcloudimg.com/http-save/yehe-12758281/09c0a75271bd3efb3e94545c007d9ae0.png) 新拍的一条 Mac 取字技巧(书上看到一段话,用系统自带功能直接把文字拖出来),我用剪映剪到 **39 秒**。以前我的习惯是讲透,一条要 1 分半;这次只留四步:问题 → 选中 → 拖走 → 结果。 **第二件:重做封面。** ![](https://developer.qcloudimg.com/http-save/yehe-12758281/7899cc6b9e0788714623cce57d7b15a4.png) 原来的封面塞了一整句:「图片上的字还要手打?Mac 上拖一下就复制走了」,20 个字,缩到手机上根本看不清。 改成两层:大字只留「图片上的字 / 还要手打?」,下面一行小字给答案。 ![](https://developer.qcloudimg.com/http-save/yehe-12758281/ed797ea41108f05380a86e31a65097bc.png) 道理很简单:**封面在信息流里是缩着看的,字数越多,字号就越小。** 手机上刷抖音,封面大概只有拇指盖那么大。 ## 六、结果怎么样?我还没拿到 这条 39 秒的视频我刚剪完,还没发。 我不想编一个"播放暴涨"的数据让文章好看。发了之后我把真实数据补在评论区——是骡子是马,看下个月的表格。 ## 七、这套方法你也能用 我不是程序员,不会写代码,更不会做数据分析。我只做了三件事: 1. 把数据整理成一张干净的表,字段别多,6 个够 1. 问具体的问题,**让它指认具体哪几条**,别要泛泛建议 1. 拿到结论只改一个变量,改完再看数据 再用它省积分:**新开一个对话比拖着一堆历史继续问更省**,长对话里它会反复读前面的内容,白白烧分。 ## 最后问你一句 你是不是也这样——发了一堆内容,播放高的不知道为什么高,低的不知道为什么低,全靠感觉改? 如果是,先别急着换选题、换封面。把过去三个月的数据整理出来,问它一句话:哪几条高、哪几条低、它们差在哪。 答案可能不是你想的那个。

资源下载

更多资源
优质分享App

优质分享App

近一个月的开发和优化,本站点的第一个app全新上线。该app采用极致压缩,本体才4.36MB。系统里面做了大量数据访问、缓存优化。方便用户在手机上查看文章。后续会推出HarmonyOS的适配版本。

腾讯云软件源

腾讯云软件源

为解决软件依赖安装时官方源访问速度慢的问题,腾讯云为一些软件搭建了缓存服务。您可以通过使用腾讯云软件源站来提升依赖包的安装速度。为了方便用户自由搭建服务架构,目前腾讯云软件源站支持公网访问和内网访问。

Spring

Spring

Spring框架(Spring Framework)是由Rod Johnson于2002年提出的开源Java企业级应用框架,旨在通过使用JavaBean替代传统EJB实现方式降低企业级编程开发的复杂性。该框架基于简单性、可测试性和松耦合性设计理念,提供核心容器、应用上下文、数据访问集成等模块,支持整合Hibernate、Struts等第三方框架,其适用范围不仅限于服务器端开发,绝大多数Java应用均可从中受益。

Rocky Linux

Rocky Linux

Rocky Linux(中文名:洛基)是由Gregory Kurtzer于2020年12月发起的企业级Linux发行版,作为CentOS稳定版停止维护后与RHEL(Red Hat Enterprise Linux)完全兼容的开源替代方案,由社区拥有并管理,支持x86_64、aarch64等架构。其通过重新编译RHEL源代码提供长期稳定性,采用模块化包装和SELinux安全架构,默认包含GNOME桌面环境及XFS文件系统,支持十年生命周期更新。

用户登录
用户注册
修改密码
忘记密码