使用ffmpeg将原始视频转换为beaglebone上的mp4

时间:2018-06-15 08:35:00

标签: video ffmpeg mp4 beagleboneblack video4linux

我真的很感激这个帮助。 我正在用我的beaglebone黑色通过网络摄像头录制视频。 相机支持的格式如下所示。

    v4l2-ctl --list-formats
ioctl: VIDIOC_ENUM_FMT
    Index       : 0
    Type        : Video Capture
    Pixel Format: 'YUYV'
    Name        : YUV 4:2:2 (YUYV)

    Index       : 1
    Type        : Video Capture
    Pixel Format: 'MJPG' (compressed)
    Name        : MJPEG

当我录制原始的4:2:2 YUV视频片段时,无法播放它以进行观看,因此我尝试使用ffmpeg将其转换为mp4。

它声明yuyv422是一种不兼容的像素格式,因此我尝试使用以下命令将视频转换为420p,output_422.yuv是我从相机录制的视频。

ffmpeg -y -pix_fmt yuyv422 -s 640x480 -r 30 -i output_422.yuv -f rawvideo -pix_fmt yuv420p -s 640x480 -r 30 output_420.yuv

结果是:

    Input #0, rawvideo, from 'output_422.yuv':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0.0: Video: rawvideo, yuyv422, 640x480, 30 tbr, 30 tbn, 30 tbc
[buffer @ 0x41520] w:640 h:480 pixfmt:yuyv422
[avsink @ 0x412c0] auto-inserting filter 'auto-inserted scaler 0' between the 
filter 'src' and the filter 'out'
[scale @ 0x44700] w:640 h:480 fmt:yuyv422 -> w:640 h:480 fmt:yuv420p 
flags:0x4
Output #0, rawvideo, to 'output_420.yuv':
  Metadata:
    encoder         : Lavf53.21.1
    Stream #0.0: Video: rawvideo, yuv420p, 640x480, q=2-31, 200 kb/s, 90k 
tbn, 30 tbc
Stream mapping:
  Stream #0.0 -> #0.0
Press ctrl-c to stop encoding
Error while decoding stream #0.0
frame=   11 fps=  0 q=0.0 Lsize=    4950kB time=0.37 bitrate=110592.0kbits/s
video:4950kB audio:0kB global headers:0kB muxing overhead 0.000000%

然后我尝试将此转换为mp4,如下所示:

ffmpeg -f rawvideo -pix_fmt yuv420p -s 640x480 -r 30 -i output_420.yuv -vcodec libx264 output.mp4

看起来转换成功,但是当我尝试通过vlc播放器播放时,我没有视频,只是闪烁了几秒钟。我试过改变分辨率,帧速率等但没有快乐。某处出了点问题,但不确定在哪里。

有人会对可能出错的事情有所了解吗?感谢

0 个答案:

没有答案
相关问题