예제 #1
0
 def parse_subs(self, ffprobe_dict):
     if ffprobe_dict == False:
         return
     sub_streams = []
     for stream in ffprobe_dict["streams"]:
         if stream["codec_type"] == "subtitle":
             language_found = None
             try:
                 language_found = stream["tags"]["language"]
             except:
                 Log.v(
                     TAG, "Could not find a language for stream " +
                     str(stream["index"]))
             # number of frames or bitrate is the best way to figure out the difference between secondary (ie foreign langauge/ forced) and primary (all text) captions.
             # There is likely a better way... still need to find it.
             br = None
             try:
                 br = stream["nb_frames"]
             except:
                 try:
                     br = stream["tags"]["NUMBER_OF_FRAMES"]
                 except:
                     pass
             sub_streams.append({
                 "index": stream["index"],
                 "codec": stream["codec_name"],
                 "language": language_found,
                 "numframes": br
             })
     return sub_streams
예제 #2
0
	def parse_audio(self, ffprobe_dict):
		if ffprobe_dict == False:
			return

		audio_streams = []

		for stream in ffprobe_dict["streams"]:
			if stream["codec_type"] == "audio":
				language_found = None
				try:
					language_found = stream["tags"]["language"]
				except:
					Log.v(TAG, "Could not find a language for stream " + str(stream["index"]))
				audio_streams.append({"index": stream["index"], "codec": stream["codec_name"], "channels": stream["channels"], "language": language_found})
		return audio_streams
예제 #3
0
    def parse_audio(self, ffprobe_dict):
        if ffprobe_dict == False:
            return

        audio_streams = []

        for stream in ffprobe_dict["streams"]:
            if stream["codec_type"] == "audio":
                language_found = None
                try:
                    language_found = stream["tags"]["language"]
                except:
                    Log.v(
                        TAG, "Could not find a language for stream " +
                        str(stream["index"]))
                audio_streams.append({
                    "index": stream["index"],
                    "codec": stream["codec_name"],
                    "channels": stream["channels"],
                    "language": language_found
                })
        return audio_streams
예제 #4
0
	def parse_subs(self, ffprobe_dict):
		if ffprobe_dict == False:
			return
		sub_streams = []
		for stream in ffprobe_dict["streams"]:
			if stream["codec_type"] == "subtitle":
				language_found = None
				try:
					language_found = stream["tags"]["language"]
				except:
					Log.v(TAG, "Could not find a language for stream " + str(stream["index"]))
				# number of frames or bitrate is the best way to figure out the difference between secondary (ie foreign langauge/ forced) and primary (all text) captions.
				# There is likely a better way... still need to find it.
				br = None
				try:
					br = stream["nb_frames"]
				except:
					try:
						br = stream["tags"]["NUMBER_OF_FRAMES"]
					except:
						pass
				sub_streams.append({"index": stream["index"], "codec": stream["codec_name"], "language": language_found, "numframes": br})
		return sub_streams
예제 #5
0
파일: ffproc.py 프로젝트: olipayne/ffproc
fileparsed = Parser(startfilename)



profile = arguments.profile
basefilename = os.path.basename(arguments.file)



if profile == None:
	regexes = json.loads(open("regexes.json").read())
	for regex in regexes:
		if re.match(regex["regex"], basefilename) != None:
			profile = regex["profile"]
			Log.v(TAG, "Got profile " + profile + " for " + basefilename)

if profile == None:
	#No regex matched either!
	profile = "default"


if profile not in allprofiles:
	Log.e(TAG, "Profile " + profile+" does not exist!")
	sys.exit()

discoveredprofile = allprofiles[profile]
#TODO: use argparse here


thistask = transformer.ffmpeg_tasks_create(fileparsed,discoveredprofile)
예제 #6
0

startfilename = arguments.file


fileparsed = Parser(startfilename)

profile = arguments.profile
basefilename = os.path.basename(arguments.file)

if profile == None:
	regexes = json.loads(open("regexes.json").read())
	for regex in regexes:
		if re.match(regex["regex"], basefilename) != None:
			profile = regex["profile"]
			Log.v(TAG, "Got profile " + profile + " for " + basefilename)

if profile == None:
	#No regex matched either!
	profile = "default"

if profile not in allprofiles:
	Log.e(TAG, "Profile " + profile+" does not exist!")
	sys.exit()

discoveredprofile = allprofiles[profile]

extension = "mp4"

if discoveredprofile["format"]["filetype"] == "matroska":
	extension = "mkv"