ros bag包转mp4视频

2023-05-16

先在 rosbag2video.py 脚本中修改相关配置参数. 或者在终端命令改也行.

如果使用脚本里的默认参数, 则可直接运行 python rosbag2video.py 2022-02-02-10-41-38.bag

代码如下:

# -*- coding: utf-8 -*-
 
#!/usr/bin/env python2
 
import roslib
#roslib.load_manifest('rosbag')
import rospy
import rosbag
import sys, getopt
import os
from sensor_msgs.msg import CompressedImage  #压缩图片
from sensor_msgs.msg import Image
import cv2
 
import numpy as np
 
import shlex, subprocess  #读取命令行参数
#subprocess 是一个 python 标准类库,用于创建进程运行系统命令,并且可以连接进程的输入输出和
#错误管道,获取它们的返回,使用起来要优于 os.system,在这里我们使用这个库运行 hive 语句并获取返回结果。
 
#shlex 是一个 python 标准类库,使用这个类我们可以轻松的做出对 linux shell 的词法分析,在
#这里我们将格式化好的 hive 连接语句用 shlex 切分,配合 subprocess.run 使用。
MJPEG_VIDEO = 1
RAWIMAGE_VIDEO = 2
VIDEO_CONVERTER_TO_USE = "ffmpeg" # or you may want to use "avconv" #视频转换器

def print_help():
    print('rosbag2video.py [--fps 25] [--rate 1] [-o outputfile] [-v] [-s] [-t topic] bagfile1 [bagfile2] ...')
    print()
    print('Converts image sequence(s) in ros bag file(s) to video file(s) with fixed frame rate using',VIDEO_CONVERTER_TO_USE)
    print(VIDEO_CONVERTER_TO_USE,'needs to be installed!')
    print()
    print('--fps   Sets FPS value that is passed to',VIDEO_CONVERTER_TO_USE)
    print('        Default is 25.')
    print('-h      Displays this help.')
    print('--ofile (-o) sets output file name.')
    print('        If no output file name (-o) is given the filename \'<prefix><topic>.mp4\' is used and default output codec is h264.')
    print('        Multiple image topics are supported only when -o option is _not_ used.')
    print('        ',VIDEO_CONVERTER_TO_USE,' will guess the format according to given extension.')
    print('        Compressed and raw image messages are supported with mono8 and bgr8/rgb8/bggr8/rggb8 formats.')
    print('--rate  (-r) You may slow down or speed up the video.')
    print('        Default is 1.0, that keeps the original speed.')
    print('-s      Shows each and every image extracted from the rosbag file (cv_bride is needed).')
    print('--topic (-t) Only the images from topic "topic" are used for the video output.')
    print('-v      Verbose messages are displayed.')
    print('--prefix (-p) set a output file name prefix othervise \'bagfile1\' is used (if -o is not set).')
    print('--start Optional start time in seconds.')
    print('--end   Optional end time in seconds.')
 
 
 
class RosVideoWriter():
    def __init__(self, fps=25.0, rate=1.0, topic="", output_filename ="", display= False, verbose = False, start = rospy.Time(0), end = rospy.Time(sys.maxsize)):
        self.opt_topic = topic
        self.opt_out_file = output_filename
        self.opt_verbose = verbose
        self.opt_display_images = display
        self.opt_start = start
        self.opt_end = end
        self.rate = rate
        self.fps = fps
        self.opt_prefix= None
        self.t_first={}
        self.t_file={}
        self.t_video={}
        self.p_avconv = {}
        
    #语法分析Args
    def parseArgs(self, args):
        opts, opt_files = getopt.getopt(args,"hsvr:o:t:p:",["fps=","rate=","ofile=","topic=","start=","end=","prefix="])
        #getopt()
        for opt, arg in opts:
            if opt == '-h':
                print_help()
                sys.exit(0)
            elif opt == '-s':
                self.opt_display_images = True
            elif opt == '-v':
                self.opt_verbose = True
            elif opt in ("--fps"):
                self.fps = float(arg)
            elif opt in ("-r", "--rate"):
                self.rate = float(arg)
            elif opt in ("-o", "--ofile"):
                self.opt_out_file = arg
            elif opt in ("-t", "--topic"):
                self.opt_topic = arg
            elif opt in ("-p", "--prefix"):
                self.opt_prefix = arg
            elif opt in ("--start"):
                self.opt_start = rospy.Time(int(arg))
                if(self.opt_verbose):
                    print("starting at",self.opt_start.to_sec())
            elif opt in ("--end"):
                self.opt_end = rospy.Time(int(arg))
                if(self.opt_verbose):
                    print("ending at",self.opt_end.to_sec())
            else:
                print("opt:", opt,'arg:', arg)
 
        if (self.fps<=0):
            print("invalid fps", self.fps)
            self.fps = 1
 
        if (self.rate<=0):
            print("invalid rate", self.rate)
            self.rate = 1
 
        if(self.opt_verbose):
            print("using ",self.fps," FPS")
        return opt_files
 
 
    # filter messages using type or only the opic we whant from the 'topic' argument
    def filter_image_msgs(self, topic, datatype, md5sum, msg_def, header):
        if(datatype=="sensor_msgs/CompressedImage"):
            if (self.opt_topic != "" and self.opt_topic == topic) or self.opt_topic == "":
                print("############# COMPRESSED IMAGE  ######################")
                print(topic,' with datatype:', str(datatype))
                print()
                return True;
 
        if(datatype=="theora_image_transport/Packet"):
            if (self.opt_topic != "" and self.opt_topic == topic) or self.opt_topic == "":
                print(topic,' with datatype:', str(datatype))
                print('!!! theora is not supported, sorry !!!')
                return False;
 
        if(datatype=="sensor_msgs/Image"):
            if (self.opt_topic != "" and self.opt_topic == topic) or self.opt_topic == "":
                print("############# UNCOMPRESSED IMAGE ######################")
                print(topic,' with datatype:', str(datatype))
                print()
                return True;
 
        return False;
 
 
    def write_output_video(self, msg, topic, t, video_fmt, pix_fmt = ""):
        # no data in this topic
        if len(msg.data) == 0 :
            return
        # initiate data for this topic
        if not topic in self.t_first :
            self.t_first[topic] = t # timestamp of first image for this topic
            self.t_video[topic] = 0
            self.t_file[topic] = 0
        # if multiple streams of images will start at different times the resulting video files will not be in sync
        # current offset time we are in the bag file
        self.t_file[topic] = (t-self.t_first[topic]).to_sec()
        # fill video file up with images until we reache the current offset from the beginning of the bag file
        while self.t_video[topic] < self.t_file[topic]/self.rate :
            if not topic in self.p_avconv:
                # we have to start a new process for this topic
                if self.opt_verbose :
                    print("Initializing pipe for topic", topic, "at time", t.to_sec())
                if self.opt_out_file=="":
                    out_file = self.opt_prefix + str(topic).replace("/", "_")+".mp4"
                else:
                    out_file = self.opt_out_file
 
                if self.opt_verbose :
                    print("Using output file ", out_file, " for topic ", topic, ".")
 
                if video_fmt == MJPEG_VIDEO :
                    cmd = [VIDEO_CONVERTER_TO_USE, '-v', '1', '-stats', '-r',str(self.fps),'-c','mjpeg','-f','mjpeg','-i','-','-an',out_file]
                    self.p_avconv[topic] = subprocess.Popen(cmd, stdin=subprocess.PIPE)
                    if self.opt_verbose :
                        print("Using command line:")
                        print(cmd)
                elif video_fmt == RAWIMAGE_VIDEO :
                    size = str(msg.width)+"x"+str(msg.height)
                    cmd = [VIDEO_CONVERTER_TO_USE, '-v', '1', '-stats','-r',str(self.fps),'-f','rawvideo','-s',size,'-pix_fmt', pix_fmt,'-i','-','-an',out_file]
                    self.p_avconv[topic] = subprocess.Popen(cmd, stdin=subprocess.PIPE)
                    if self.opt_verbose :
                        print("Using command line:")
                        print(cmd)
 
                else :
                    print("Script error, unknown value for argument video_fmt in function write_output_video.")
                    exit(1)
            # send data to ffmpeg process pipe
            self.p_avconv[topic].stdin.write(msg.data)
            # next frame time
            self.t_video[topic] += 1.0/self.fps
 
    def addBag(self, filename):
        if self.opt_display_images:
            from cv_bridge import CvBridge, CvBridgeError
            bridge = CvBridge()
            cv_image = []

        if self.opt_verbose :
            print("Bagfile: {}".format(filename))
 
        if not self.opt_prefix:
            # create the output in the same folder and name as the bag file minu '.bag'
            self.opt_prefix = bagfile[:-4]
 
        #Go through the bag file
        bag = rosbag.Bag(filename)
        if self.opt_verbose :
            print("Bag opened.")
        # loop over all topics
        for topic, msg, t in bag.read_messages(connection_filter=self.filter_image_msgs, start_time=self.opt_start, end_time=self.opt_end):
            try:
                if msg.format.find("jpeg")!=-1 :
                    if msg.format.find("8")!=-1 and (msg.format.find("rgb")!=-1 or msg.format.find("bgr")!=-1 or msg.format.find("bgra")!=-1 ):
                        if self.opt_display_images:
                            np_arr = np.fromstring(msg.data, np.uint8)
                            cv_image = cv2.imdecode(np_arr, cv2.CV_LOAD_IMAGE_COLOR)
                        self.write_output_video( msg, topic, t, MJPEG_VIDEO )
                    elif msg.format.find("mono8")!=-1 :
                        if self.opt_display_images:
                            np_arr = np.fromstring(msg.data, np.uint8)
                            cv_image = cv2.imdecode(np_arr, cv2.CV_LOAD_IMAGE_COLOR)
                        self.write_output_video( msg, topic, t, MJPEG_VIDEO )
                    elif msg.format.find("16UC1")!=-1 :
                        if self.opt_display_images:
                            np_arr = np.fromstring(msg.data, np.uint16)
                            cv_image = cv2.imdecode(np_arr, cv2.CV_LOAD_IMAGE_COLOR)
                        self.write_output_video( msg, topic, t, MJPEG_VIDEO )
                    else:
                        print('unsupported jpeg format:', msg.format, '.', topic)
 
            # has no attribute 'format'
            except AttributeError:
                try:
                        pix_fmt=None
                        if msg.encoding.find("mono8")!=-1 or msg.encoding.find("8UC1")!=-1:
                            pix_fmt = "gray"
                            if self.opt_display_images:
                                cv_image = bridge.imgmsg_to_cv2(msg, "bgr8")
 
                        elif msg.encoding.find("bgra")!=-1 :
                            pix_fmt = "bgra"
                            if self.opt_display_images:
                                cv_image = bridge.imgmsg_to_cv2(msg, "bgr8")
 
                        elif msg.encoding.find("bgr8")!=-1 :
                            pix_fmt = "bgr24"
                            if self.opt_display_images:
                                cv_image = bridge.imgmsg_to_cv2(msg, "bgr8")
                        elif msg.encoding.find("bggr8")!=-1 :
                            pix_fmt = "bayer_bggr8"
                            if self.opt_display_images:
                                cv_image = bridge.imgmsg_to_cv2(msg, "bayer_bggr8")
                        elif msg.encoding.find("rggb8")!=-1 :
                            pix_fmt = "bayer_rggb8"
                            if self.opt_display_images:
                                cv_image = bridge.imgmsg_to_cv2(msg, "bayer_rggb8")
                        elif msg.encoding.find("rgb8")!=-1 :
                            pix_fmt = "rgb24"
                            if self.opt_display_images:
                                cv_image = bridge.imgmsg_to_cv2(msg, "bgr8")
                        elif msg.encoding.find("16UC1")!=-1 :
                            pix_fmt = "gray16le"
                        else:
                            print('unsupported encoding:', msg.encoding, topic)
                            #exit(1)
                        if pix_fmt:
                            self.write_output_video( msg, topic, t, RAWIMAGE_VIDEO, pix_fmt )
 
                except AttributeError:
                    # maybe theora packet
                    # theora not supported
                    if self.opt_verbose :
                        print("Could not handle this format. Maybe thoera packet? theora is not supported.")
                    pass
            if self.opt_display_images:
                cv2.imshow(topic, cv_image)
                key=cv2.waitKey(1)
                if key==1048603:
                    exit(1)
        if self.p_avconv == {}:
            print("No image topics found in bag:", filename)
        bag.close()
 
 
 
if __name__ == '__main__':
    #print()
    #print('rosbag2video, by Maximilian Laiacker 2020 and Abel Gabor 2019')
    #print()
 
    if len(sys.argv) < 2:
        print('Please specify ros bag file(s)!')
        print_help()
        sys.exit(1)
    else :
        videowriter = RosVideoWriter()
        try:
            opt_files = videowriter.parseArgs(sys.argv[1:])
        except getopt.GetoptError:
            print_help()
            sys.exit(2)
 

    # loop over all files
    for files in range(0,len(opt_files)):
        #First arg is the bag to look at
        bagfile = opt_files[files]
        videowriter.addBag(bagfile)
    print("finished")
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

ros bag包转mp4视频 的相关文章

  • 嵌入 mp4 视频时出现问题

    我正在尝试使用 html5 视频标签来嵌入 mp4 但我遇到了一些在不同浏览器中有所不同的问题 我的代码如下所示
  • 如何使用 JCodec 将一系列图像转换为视频?

    我正在尝试使用 JCodec 将一系列图像转换为 Java SE 桌面应用程序内的视频 我尝试过的几种方法都导致 Windows Media Player 无法播放视频 我不清楚这是否是编解码器问题 值得怀疑 或者我是否没有正确创建视频 当
  • 将 H.264 帧复用到 MP4 时,Media Foundation IMFSinkWriter::Finalize() 方法在 Windows 7 下失败

    我正在用 C 编写一个工具 将 H 264 帧混合到 MP4 文件中 并且我使用 Media Foundation 的媒体接收器和接收器编写器来执行此操作 在 Win8 下一切工作得很好 但在 Windows 7 下 当调用接收器编写器的
  • 为什么 PHP 会干扰我的 HTML5 MP4 视频?

    我正在编写一个提供 H 264 编码 MP4 视频的 Web 应用程序 在 Chrome 和 Safari 中 它通过 HTML5 视频标签来完成此操作 为了控制对这些视频的访问 它们的内容通过 PHP 使用非常简单的机制提供 header
  • 我的代码的 Boost 更新问题

    我最近将 boost 更新到 1 59 并安装在 usr local 中 我的系统默认安装在 usr 并且是1 46 我使用的是ubuntu 12 04 我的代码库使用 ROS Hydro 机器人操作系统 我有一个相当大的代码库 在更新之前
  • 将 mkv 转换为 h264 FFmpeg

    EDIT 这个问题已经变得非常流行 并且是搜索 convert mkv to h264 ffmpeg 的最佳结果之一 因此我认为对于任何偶然发现这个问题的人来说 添加这一点是适当的 而不是使用 ffmpeg i input mkv c v
  • 如何访问 Heroku 中的 docker 容器?

    我已按照此处构建图像的说明进行操作 https devcenter heroku com articles container registry and runtime getting started https devcenter her
  • 在设备上将 GIF 转换为 MP4

    是否可以获取远程 但如果需要的话我可以先下载 GIF 序列并在设备上制作 MPMovies PlayerViewController 可播放的 mp4 我尝试过使用http api online convert com http api o
  • 使用 http 的 Range 标头下载视频的后半部分

    我想下载本地主机上视频的后半部分 我编写了一些 python 代码来下载从一半到结尾的文件 通过 http 的 Range 标头 但是当我用 vlc 打开文件时 没有任何反应 所以它不起作用 如何下载 mp4 文件的一部分并且仍然能够观看它
  • 在 ROS - Python 中使用来自多个主题的数据

    我能够显示来自两个主题的数据 但无法在 ROS 中实时使用和计算这两个主题的数据 用 Python 代码编写 您有想法存储这些数据并实时计算吗 谢谢 usr bin env python import rospy import string
  • ROS 从 python 节点发布数组

    我是 ros python 的新手 我正在尝试从 python ros 节点发布一个一维数组 我使用 Int32MultiArray 但我无法理解多数组中布局的概念 谁能给我解释一下吗 或者还有其他方式发布数组吗 Thanks usr bi
  • 获取 MP4 流长度

    我正在一个应用程序中工作 我们使用 IMediaDet 来获取流长度 现在我们开始使用 MP4 容器 问题是 当我尝试使用 MP4 文件使用 IMediaDet put fileName 时 我得到 HRESULT 2147024770 E
  • 在 Gstreamer 上流式传输 MP4 视频文件

    我第一次使用 gstreamer 并尝试使用 Gstreamer RTP 和 UDP 将 MP4 视频文件从服务器流式传输到客户端 我尝试使用的命令行 在服务器端 gst launch 1 0 v filesrc location file
  • Android - 播放视频的不同方式

    我刚刚遇到了 VideoView 的限制 无法播放宽度超过 320 像素的 mp4 视频文件 我想知道我们如何才能克服这些限制 我试图让我的应用程序尽可能宽容 所以除了使用 VideoViews 之外 还有其他方法来播放这些 mp4 视频吗
  • Mp4 视频旋转元数据

    我开发了一个 android ios 视频共享应用程序 可以录制视频并将其上传到亚马逊 s3 为了兼容 android ios 以 mp4 格式录制 H264 AAC 编解码器 用户可以拍摄肖像或风景 应用程序从传感器获取信息 设置文件的旋
  • HTML5 视频:ffmpeg 编码的 MP4 无法在任何浏览器中播放(但可以在 VLC 中播放)

    我正在尝试以 MP4 和 WEBM 格式提供 HTML5 视频 但我无法让所有浏览器都工作 支持 WEBM 的浏览器 Chrome 桌面版 Firefox 桌面版 可以正常播放视频 使用 MP4 的浏览器无法运行 IE Safari And
  • 如何从里程计/tf数据获取投影矩阵?

    我想将视觉里程计的结果与 KITTI 数据集提供的事实进行比较 对于地面中的每一帧 我都有一个投影矩阵 例如 1 000000e 00 9 043683e 12 2 326809e 11 1 110223e 16 9 043683e 12
  • 如何在 jQuery 图像滑块中播放视频?

    我有一个 jQuery 滑块 是我在 WordPress 网站上用 jQuery 编写的 如果 src 扩展名是 mp4 我想让它播放视频 有任何想法吗 以下是生成的 HTML 示例 请注意第一个 img src 是视频链接 我想让访问者单
  • 如何在Windows上安装机器人操作系统ROSJava?

    ROS 的文档很糟糕 一个很大的讽刺是 ROS 的 Groovy 和 ROSJava 版本的创建是为了让 Windows 等平台上的开发人员能够利用出色的机器人 SDK 而所有安装说明仍然面向 Linux ubuntu 用户 The ROS
  • iOS-如何使用 AVAsset 或 AVURLAsset 获取 .mp4 文件的持续时间

    我知道视频类型问题的持续时间之前已得到解答 但我在获取视频持续时间方面遇到了真正的麻烦 mp4文件通过使用AVAsset and by AVURLAsset 我正在使用以下代码 NSString itemPathString NSSearc

随机推荐

  • NVIDIA显卡BUG解决 Unable to determine the device handle for GPU 0000:02:00.0: Unknown Error

    报错 实验室去年到今年断了几次电 xff0c 然后服务器上的2080Ti一直就感觉有点小毛病 属于是被折磨了几个月了 然后前两周断电后 xff0c 显卡就基本上完全用不了了 xff0c 经常服务器开机都会失败 并且就算服务器开机成功过后 x
  • 数据库E-R图基础概念

    E R图也称实体 联系图 Entity Relationship Diagram xff0c 提供了表示实体类型 属性和联系的方法 xff0c 用来描述现实世界的概念模型 ER模型的基本元素 实体 xff1a 用方框表示 xff0c 实体名
  • 51单片机蜂鸣器

    蜂鸣器分为两类 1 有源蜂鸣器 2 无源蜂鸣器 有源蜂鸣器比较简单 xff0c 只要有电流通过 xff0c 蜂鸣器就会发声 一般改变不了音调和音量 无源蜂鸣器要给一定频率的脉冲信号 xff0c 蜂鸣器才会发出声音 对于无源蜂鸣器只要改变频率
  • 数据分析----数据清洗

    文章目录 前言一 数据清洗是什么 xff1f 二 步骤1 选择列2 缺失值处理1 找到缺失值2 处理缺失值的方法 3 数据类型转化4 重复值处理 总结 前言 随着科技的不断发展 xff0c 数据在我们生活中越来越多 xff0c 面对繁杂的数
  • python装饰器

    装饰器 一 概念 1 装饰器 xff08 Decoration xff09 装饰器是一种设计模式 xff0c 经常用来实现 34 面向切面的编程 34 AOP 实现在不修改源代码的情况下 xff0c 给程序动态添加功能的一种技术 2 装饰器
  • 拒绝拖延!

  • 使用qemu-img转换镜像格式

    qemu功能强大 xff0c 详细了解其功能请到官网查看 https www qemu org docs master system images html qemu img能将RAW qcow2 VMDK VDI VHD xff08 vp
  • KEIL5MDK最新版(3.37)安装以及旧编译器(V5)安装

    最近KEIl5最新版本出来了 xff0c 但官方不在默认安装V5编译器 xff0c 导致某些代码无法兼容 xff0c 为了防止搞忘 xff0c 便把方法上传网上 旧编译器的安装思路是 在以前有V5编译器的KEILMDK安装包中复制粘贴到新的
  • mp4转ros bag包

    操作方法 python2 mp4 to bag py lane video mp4 lane camera bag 执行转化命令 rosbag play l TLout bag camera image raw 61 image raw0
  • 深度学习之卷积神经网络CNN详细

    需要PPT加Q1271370903 一 深度学习引入 1 各学习方法之间的联系 SL SSL和UL是传统ML方法 DL提供了一个更强大的预测模型 可产生良好的预测结果 RL提供了更口快的学习机制 且更适应环境的变化 TL突破了任务的限制 将
  • 基于51单片机实现红外循迹

    红外循迹外观 xff1a 红外循迹原理 xff1a 红外循迹模块原理还是很简单的 xff0c 和许多光电传感器原理一样 xff0c 当发射器发射出去的光被接收器接收到后 xff0c 模块上对应的LED灯点亮 xff0c 此时相应的输出引脚输
  • Ubuntu“从服务器获取共享列表失败:拒绝连接”问题的解决方法

    本来是可以的 xff0c 在安装nginx后 xff0c ubuntu连接不上共享文件 有过以下尝试 删除nginx和所有配置 xff0c 关闭代理 或者搜一些什么安装smbd包什么的 还有连接ip地址进行挂载的 以及开放端口 我解决的方法
  • C语言:scanf的使用

    目录 一 scanf的循环读取 1 scanf的一次读取 2 加入while循环使scanf能进行循环读取 3 由于scanf出错时会返回EOF xff0c 故代码改为 4 加入rewind清空缓冲区 xff08 只适用于vs xff09
  • 搭建mysql的主从关系

    目录 1 什么是mysql主从 2 为什么要使用MySQL主从 3 MySQL主从的实现原理 4 如何搭建mysql主从关系 4 1 搭建两台有mysql的虚拟机 可以克隆 4 2 保证自己的mysql可以远程访问 4 3 修改ip地址 因
  • 关于虚拟机装Anaconda教学

    文章目录 一 第一步装VMware Workstation Pro虚拟机的安装二 下载虚拟机镜像文件三 安装python解释器 xff0c 安装Anaconda xff1a python解释器 xff1a 直接在DOS上安装 xff0c 操
  • C#ftp服务器配置与文件上传

    个人分享 public void test ftp服务器路径 string ftpServer 61 34 ftp 192 168 0 1 34 ftp本地路径 string ftpDefaultUrl 61 34 A 34 登入到ftp的
  • 完整的前端项目开发流程

    一个项目从一开始的计划到最后的上线 大概要经过以下的流程 产品设计原型审评项目分工项目开发项目测试项目构建项目上线 1产品设计 主要负责人 产品经理 产品经理前期负责收集销售 客户 领导的零散需求 然后做需求分析 完成产品设计 需求分析 需
  • debian11 sid

    编辑 etc apt sources list xff0c 增加下面二行 xff1a deb http ftp us debian org debian sid main contrib non free deb src http ftp
  • 单片机学习——定时器/计数器

    单片机必学系列 单片机学习 中断系统 单片机学习 存储器详解 xff08 程序存储器 片内RAM 拓展RAM EEPROM xff09 单片机学习 定时器 计数器 单片机学习 A D转换 更新ing 单片机学习 定时器 计数器 单片机必学系
  • ros bag包转mp4视频

    先在 rosbag2video py 脚本中修改相关配置参数 或者在终端命令改也行 如果使用脚本里的默认参数 则可直接运行 python rosbag2video py 2022 02 02 10 41 38 bag 代码如下 span c