Ejemplo n.º 1
0
def ffmpeg_args():
    ret = ['ffmpeg', '-f']

    p = Platform()
    if p.isMacOSX():
        ret.append('avfoundation')
    elif p.isLinux():
        ret.append('v4l2')
    else:
        raise NotImplementedError

    ret.extend([
        '-framerate',
        '30',
        '-video_size',
        '640x480',
    ])

    if p.isMacOSX():
        ret.extend([
            '-i',
            'default',
            '-f',
            'avfoundation',
            '-i',
            ':0',
        ])
    elif p.isLinux():
        ret.extend([
            '-i',
            '/dev/video0',
            '-f',
            'alsa',
            '-thread_queue_size',
            '99999',
            '-i',
            'hw:0',
        ])

    ret.extend([
        '-async',
        '1',
        '-c:a',
        'aac',
        '-vcodec',
        'libx264',
        '-tune',
        'zerolatency',
        '-preset',
        'veryfast',
        '-x264opts',
        'crf=20:vbv-maxrate=3000:vbv-bufsize=100:intra-refresh=1:slice-max-size=1500:keyint=30:ref=1',
    ])

    # Ubuntu-only?
    if p.isLinux() and isUbuntu():
        ret.extend(['-strict', '-2'])

    ret.extend(['-f', 'mpegts', '-'])
    return ret
Ejemplo n.º 2
0
 def test_isMacOSXConsistency(self):
     """
     L{Platform.isMacOSX} can only return C{True} if L{Platform.getType}
     returns C{'posix'}.
     """
     platform = Platform()
     if platform.isMacOSX():
         self.assertEqual(platform.getType(), 'posix')
Ejemplo n.º 3
0
 def test_isMacOSXConsistency(self):
     """
     L{Platform.isMacOSX} can only return C{True} if L{Platform.getType}
     returns C{'posix'}.
     """
     platform = Platform()
     if platform.isMacOSX():
         self.assertEqual(platform.getType(), 'posix')
Ejemplo n.º 4
0
 def test_isVistaConsistency(self):
     """
     Verify consistency of L{Platform.isVista}: it can only be C{True} if
     L{Platform.isWinNT} and L{Platform.isWindows} are C{True}.
     """
     platform = Platform()
     if platform.isVista():
         self.assertTrue(platform.isWinNT())
         self.assertTrue(platform.isWindows())
         self.assertFalse(platform.isMacOSX())
Ejemplo n.º 5
0
 def test_isVistaConsistency(self):
     """
     Verify consistency of L{Platform.isVista}: it can only be C{True} if
     L{Platform.isWinNT} and L{Platform.isWindows} are C{True}.
     """
     platform = Platform()
     if platform.isVista():
         self.assertTrue(platform.isWinNT())
         self.assertTrue(platform.isWindows())
         self.assertFalse(platform.isMacOSX())