FFPLAY显示视频,但FFMPEG只显示黑色

时间:2017-05-21 21:58:11

标签: ffmpeg directshow

我尝试使用 ffmpeg 从VIDBOX设备录制视频/音频。使用Windows 10和 ffmpeg 版本N-86129-g1e8daf3,我可以在执行时看到和听到视频/音频正常

public static void gameModeSelect() {
    System.out.println("Welcome to Rock, Paper, Scissors 1.0 !\n Please select your game mode: ");
    System.out.println("1. Player vs. Computer\n 2. Player vs. Player ");
}

public static void winLoss(char P1, char P2) {

    if (P1 == 'P' && P2 == 'R') {
        System.out.println("Paper covers rock!\nPlayer one wins!");
    } else if (P1 == 'R' && P2 == 'P') {
        System.out.println("Paper covers rock!\nPlayer two wins!");
    }
    if (P1 == 'R' && P2 == 'S') {
        System.out.println("Rock breaks scissors!\nPlayer one wins!");
    } else if (P1 == 'S' && P2 == 'R') {
        System.out.println("Rock breaks scissors!\nPlayer two wins!");
    }
    if (P1 == 'S' && P2 == 'P') {
        System.out.println("Scissor cuts paper!\nPlayer one wins!");
    } else if (P1 == 'P' && P2 == 'S') {
        System.out.println("Scissor cuts paper!\nPlayer two wins!");
    }
}

public static void main(String[] args) {
    Scanner keyboard = new Scanner(System.in);

    char P1;
    char P2;
    int modeSelect;

    gameModeSelect();
    modeSelect = keyboard.nextInt();

    if (modeSelect == 1) {
        System.out.println("Oops, this feature in currently unavailable. Play with a friend for now :-)");
    } else if (modeSelect == 2) {

        System.out.println("Rules of the game:  R = Rock, P = Paper, S = Scissors\n Good luck! ");

        System.out.println("Player one: Enter your move");
        P1 = keyboard.next().charAt(0);
        System.out.println("Player two: Enter your move");
        P2 = keyboard.next().charAt(0);
        winLoss(P1, P2);

    }
}

但是,我只执行

时录制黑屏(以及正确的音频)
ffplay -f dshow -i video="VIDBOX NW07":audio="Microphone (VIDBOX NW07)"

是什么导致这种情况在 ffplay 中起作用而不是 ffmpeg

1 个答案:

答案 0 :(得分:0)

您可能正在测试通用播放器中的输出。添加-pix_fmt yuv420p以强制ffmpeg的输出为所有玩家可以显示的标准像素格式。