gems/streamio-ffmpeg/lib/ffmpeg/movie.rb in apple-tv-converter-0.5.9 vs gems/streamio-ffmpeg/lib/ffmpeg/movie.rb in apple-tv-converter-0.6.0
- old
+ new
@@ -47,17 +47,17 @@
output[/Audio:\ (.*)/]
@audio_stream = $1
if video_stream
- @video_codec, @colorspace, resolution, video_bitrate = video_stream.split(/\s?,\s?/)
+ @video_codec, @colorspace, resolution, video_bitrate = video_stream.scan(/([^,()\[\]]+(?:\s*(?:\[|\().*?(?:\]|\)))*)\s?,?\s?/).flatten
@video_bitrate = video_bitrate =~ %r(\A(\d+) kb/s\Z) ? $1.to_i : nil
@resolution = resolution.split(" ").first rescue nil # get rid of [PAR 1:1 DAR 16:9]
@dar = $1 if video_stream[/DAR (\d+:\d+)/]
end
if audio_stream
- @audio_codec, audio_sample_rate, @audio_channels, unused, audio_bitrate = audio_stream.split(/\s?,\s?/)
+ @audio_codec, audio_sample_rate, @audio_channels, unused, audio_bitrate = audio_stream.scan(/([^,()\[\]]+(?:\s*(?:\[|\().*?(?:\]|\)))*)\s?,?\s?/).flatten
@audio_bitrate = audio_bitrate =~ %r(\A(\d+) kb/s(?: \(default\))?\Z) ? $1.to_i : nil
@audio_sample_rate = audio_sample_rate[/\d*/].to_i
end
@invalid = true if @video_stream.to_s.empty? && @audio_stream.to_s.empty?
\ No newline at end of file