配置ffmpeg和ffplay为PAL信号

配置ffmpeg和ffplay为PAL信号

我有一台 PAL 相机和一台基于 stk1160 的视频采集器,在 Linux 下可以正确识别为 /dev/videoN。将视频标准设置为 PAL 后,我可以使用 vlc 观看视频:

为了完成我的项目,我不得不使用 ffmpeg。在默认配置中,ffmpeg 似乎使用 NTSC 标准 - 图像呈灰度且闪烁:

如何在ffmpeg中设置PAL视频标准?


我正在使用的命令:

  1. 要查看提要:ffplay /dev/video1

    ffplay version 2.5.3 Copyright (c) 2003-2015 the FFmpeg developers
    built on Feb  2 2015 13:40:23 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
    configuration: --prefix=/home/grzebien/ffmpeg/ffmpeg_build --extra-cflags=-I/home/grzebien/ffmpeg/ffmpeg_build/include --extra-ldflags= L/home/grzebien/ffmpeg/ffmpeg_build/lib --bindir=/home/grzebien/ffmpeg/bin --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree
    libavutil      54. 15.100 / 54. 15.100
    libavcodec     56. 13.100 / 56. 13.100
    libavformat    56. 15.102 / 56. 15.102
    libavdevice    56.  3.100 / 56.  3.100
    libavfilter     5.  2.103 /  5.  2.103
    libswscale      3.  1.101 /  3.  1.101
    libswresample   1.  1.100 /  1.  1.100
    libpostproc    53.  3.100 / 53.  3.100
    Input #0, video4linux2,v4l2, from '/dev/video1':B sq=    0B f=0/0   
    Duration: N/A, start: 6274.569205, bitrate: 165722 kb/s
    Stream #0:0: Video: rawvideo (UYVY / 0x59565955), uyvy422, 720x480, 165722 kb/s, 29.97 fps, 29.97 tbr, 1000k tbn, 1000k tbc
    6276.06 M-V:  0.000 fd=   0 aq=    0KB vq=    0KB sq=    0B f=0/0
    
  2. 记录:ffmpeg -f v4l2 -i /dev/video1 -r 25 -c:v libx264 ~/Desktop/output1.mkv

    ffmpeg version 2.5.3 Copyright (c) 2000-2015 the FFmpeg developers
    built on Feb  2 2015 13:40:23 with gcc 4.8 (Ubuntu 4.8.2-19ubuntu1)
    configuration: --prefix=/home/grzebien/ffmpeg/ffmpeg_build --extra-cflags=-I/home/grzebien/ffmpeg/ffmpeg_build/include --extra-ldflags=-L/home/grzebien/ffmpeg/ffmpeg_build/lib --bindir=/home/grzebien/ffmpeg/bin --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-nonfree
    libavutil      54. 15.100 / 54. 15.100
    libavcodec     56. 13.100 / 56. 13.100
    libavformat    56. 15.102 / 56. 15.102
    libavdevice    56.  3.100 / 56.  3.100
    libavfilter     5.  2.103 /  5.  2.103
    libswscale      3.  1.101 /  3.  1.101
    libswresample   1.  1.100 /  1.  1.100
    libpostproc    53.  3.100 / 53.  3.100
    Input #0, video4linux2,v4l2, from '/dev/video1':
    Duration: N/A, start: 6143.863828, bitrate: 165722 kb/s
    Stream #0:0: Video: rawvideo (UYVY / 0x59565955), uyvy422, 720x480, 165722 kb/s, 29.97 fps, 29.97 tbr, 1000k tbn, 1000k tbc
    File '/home/grzebien/Desktop/output1.mkv' already exists. Overwrite ? [y/N] y
    No pixel format specified, yuv422p for H.264 encoding chosen.
    Use -pix_fmt yuv420p for compatibility with outdated media players.
    [libx264 @ 0x23fa9c0] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX
    [libx264 @ 0x23fa9c0] profile High 4:2:2, level 3.0, 4:2:2 8-bit
    [libx264 @ 0x23fa9c0] 264 - core 142 r2389 956c8d8 - H.264/MPEG-4 AVC 
    codec - Copyleft 2003-2014 - http://www.videolan.org/x264.html - 
    options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=4 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
    Output #0, matroska, to '/home/grzebien/Desktop/output1.mkv':
    Metadata:
    encoder         : Lavf56.15.102
    Stream #0:0: Video: h264 (libx264) (H264 / 0x34363248), yuv422p, 720x480, q=-1--1, 25 fps, 1k tbn, 25 tbc
    Metadata:
    encoder         : Lavc56.13.100 libx264
    Stream mapping:
    Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (libx264))
    Press [q] to stop, [?] for help
    frame=   54 fps= 53 q=28.0 size=86kB time=00:00:00.16 bitrate=1391.5kbits/s
    

答案1

使用:-standard pal

我遇到了同样的问题并且花了很多天寻找答案!

ffmpeg 文档https://www.ffmpeg.org/ffmpeg.html没有提到任何内容。在其他页面上我看到了,-tvstd standard set television standard (NTSC, PAL (SECAM))但没有用。我找到了这个-standard选项ffplay -h

答案2

如需录制,请尝试

ffmpeg -f v4l2 -standard PAL -i /dev/video1 -r 25 -c:v libx264 ~/Desktop/output1.mkv

相关内容