小编Pik*_*ack的帖子

Python ffmpeg 子进程:管道损坏

以下脚本使用 OpenCV 读取视频,对每个帧应用转换,并尝试使用 ffmpeg 写入它。我的问题是,我无法让 ffmpeg 使用该subprocess模块。BrokenPipeError: [Errno 32] Broken pipe我总是在尝试写入标准输入的行中收到错误。为什么会这样,我做错了什么?

# Open input video with OpenCV
video_in = cv.VideoCapture(src_video_path)
frame_width = int(video_in.get(cv.CAP_PROP_FRAME_WIDTH))
frame_height = int(video_in.get(cv.CAP_PROP_FRAME_HEIGHT))
fps = video_in.get(cv.CAP_PROP_FPS)
frame_count = int(video_in.get(cv.CAP_PROP_FRAME_COUNT))
bitrate = bitrate * 4096 * 2160 / (frame_width * frame_height)

# Process video in ffmpeg pipe
# See http://zulko.github.io/blog/2013/09/27/read-and-write-video-frames-in-python-using-ffmpeg/
command = ['ffmpeg',
           '-loglevel', 'error',
           '-y',
           # Input
           '-f', 'rawvideo',
           '-vcodec', 'rawvideo'
           '-pix_fmt', 'bgr24',
           '-s', str(frame_width) + 'x' + str(frame_height),
           '-r', str(fps),
           # Output …
Run Code Online (Sandbox Code Playgroud)

python subprocess ffmpeg python-3.x

9
推荐指数
1
解决办法
1万
查看次数

VB.NET overload()运算符

我是VB.NET的新手,并且搜索一个复制DataRow行为的方法.在VB.NET中我可以写这样的东西:

Dim table As New DataTable
'assume the table gets initialized
table.Rows(0)("a value") = "another value"
Run Code Online (Sandbox Code Playgroud)

现在如何用括号访问班级成员?我以为我可以重载()运算符,但这似乎不是答案.

vb.net brackets

7
推荐指数
1
解决办法
1267
查看次数

ffmpeg:从视频容器中提取未知数据流

我有一个 .MOV 容器,其中包含以下曲目:

Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 3840x2160 [SAR 1:1 DAR 16:9], 100619 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
Metadata:
  creation_time   : 2020-07-21T22:48:24.000000Z
  handler_name    : DJI.AVC
  encoder         : AVC encoder
Stream #0:1(eng): Data: none (priv / 0x76697270), 87 kb/s
Metadata:
  creation_time   : 2020-07-21T22:48:24.000000Z
  handler_name    : DJI.Meta
Stream #0:2(eng): Subtitle: mov_text (text / 0x74786574), 2 kb/s (default)
Metadata:
  creation_time   : 2020-07-21T22:48:24.000000Z
  handler_name    : DJI.Subtitle
Run Code Online (Sandbox Code Playgroud)

如您所见,流 #0:1(称为 DJI.meta)的数据格式未知。我只想将该流的原始数据提取到文件中。这就是我尝试过的 ffmpeg 命令:

ffmpeg -i …
Run Code Online (Sandbox Code Playgroud)

ffmpeg

6
推荐指数
1
解决办法
6128
查看次数

计算两个列表的所有 IoU 的有效方法

我有一个函数来计算两个矩形/边界框的 IoU。

def intersection_over_union(boxA, boxB):
    # determine the (x, y)-coordinates of the intersection rectangle
    xA = max(boxA[0], boxB[0])
    yA = max(boxA[1], boxB[1])
    xB = min(boxA[2], boxB[2])
    yB = min(boxA[3], boxB[3])

    # compute the area of intersection rectangle
    interArea = max(0, xB - xA + 1) * max(0, yB - yA + 1)

    # compute the area of both the prediction and ground-truth
    # rectangles
    boxAArea = (boxA[2] - boxA[0] + 1) * (boxA[3] - boxA[1] + 1)
    boxBArea = (boxB[2] …
Run Code Online (Sandbox Code Playgroud)

python numpy

1
推荐指数
1
解决办法
2243
查看次数

标签 统计

ffmpeg ×2

python ×2

brackets ×1

numpy ×1

python-3.x ×1

subprocess ×1

vb.net ×1