我的视频是佳能相机拍的 MP4 文件。拍的时候是竖版。但是 POTPLAYER 播放的时候是以横版来播放的。 我想把这些横版视频,旋转 90 度,变成拍摄时候的视角。 请问,是否可以利用 ffmpeg,来批量的旋转一下? 如果 ffmpeg 不能实现,是否有其他的软件能快捷的实现批量无损旋转?
|      1mfsw OP 跟 chatgpt 斗智斗勇了好久,他都没能提供给我一个可用的 ffmpeg 的命令。诸位大佬请发威吧。 | 
|      2qwertyegg      2023-12-30 00:16:42 +08:00 ffmpeg -i input.mp4 -vf "transpose=1" output.mp4 transpose=1 或者=2 | 
|      3mfsw OP @qwertyegg 感谢大佬指教。实测不行,跟 gpt 的答案差不多,视频被旋转了,但是容量变得很小。只有原来的二十分之一。 | 
|      4qwertyegg      2023-12-30 00:35:58 +08:00 ffmpeg -display_rotation:v:0 90 -i input.mp4 -c copy output.mp4 这样 stream copy/remux 出来的视频,不重新编码 | 
|  |      5AoEiuV020JP      2023-12-30 00:41:54 +08:00 via Android %bin%ffmpeg -i "%name%%ext%" -c copy -metadata:s:v:0 rotate=%rotate% "%name%-%rotate%%ext%" | 
|      6mfsw OP 大佬威武,在大佬面前,gpt 就是个弱智。 再请教下,我要把您的这行代码,修改为一个批处理脚本。 我要把指定目录下的所有 mp4 文件,都旋转 90 度,并替换删除原始文件,我该怎么修改? 我希望这个批处理,能提供一个输入选项,让我可以输入指定的目录。 感谢大佬搭救。 | 
|      8mfsw OP @AoEiuV020JP 感谢指教。4 楼大佬的方法好用。就不尝试其他方案了。辛苦您啦。 | 
|      9qwertyegg      2023-12-30 00:54:46 +08:00 用 ahk(v2)可以参考如下 targetPattern := concat3("c:\captures\", prefix, "*.mp4") udp_profiles := [] loop files targetPattern udp_profiles.Push(A_LoopFileName) } | 
|      11qwertyegg      2023-12-30 02:44:56 +08:00 下面这段 ahk 代码,"把 ffmpeg 加到 path 里面"和"mp4 文件不要带空格“两个要求满足的时候应该就可以批量转了 #Requires AutoHotkey v2.0 #SingleInstance Force ; Get list of files matching a prefix under a folder. ; Set prefix an empty string "" if we want all, otherwise add prefix to limit selection prefix := "" ;=============== init script =============== targetPattern := concat3("D:\captures\", prefix, "*.mp4") video_files := [] loop files targetPattern video_files.Push(A_LoopFileName) lastIndex := video_files.Length ;;;;;;;;;;; F2 to cycle through rotation jobs #MaxThreadsPerHotkey 1 F2::{ static counter := 1 while (counter <= lastIndex){ ffmpeg_rotate(video_files[counter]) counter := counter + 1 } ; MsgBox "That was the last, exit." ExitApp } ffmpeg_rotate(video_file){ SetWorkingDir "D:\captures" Run concat4("ffmpeg -display_rotation:v:0 90 -i ", video_file, " -c copy rotated_", video_file) } concat3(x, y, z) { Return x y z } concat4(w, x, y, z) { Return w x y z } | 
|  |      13miaotaizi      2023-12-30 11:46:42 +08:00 把屏幕竖起来? | 
|      14forgottencoast      2023-12-30 22:06:28 +08:00 @mfsw  批处理这个问题 chatGPT 保证不弱智,你问它就行了。 | 
|      15mfsw OP @forgottencoast 3.5 ruozhi ,4.0 可能不 ruozhi 。但是我现在没有 4.0 的账号了。 | 
|  |      161014982466      2023-12-31 22:22:02 +08:00 LOSSLESSCUT |