├── .gitignore ├── FFmpeg.m ├── LICENSE ├── README.md ├── Tests ├── Test_Import_FFprobe_info.nb └── tempFFprobe.log └── ffmpeg examples.nb /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by .ignore support plugin (hsz.mobi) 2 | ### Example user template template 3 | ### Example user template 4 | 5 | # IntelliJ project files 6 | .idea 7 | *.iml 8 | out 9 | gen 10 | -------------------------------------------------------------------------------- /FFmpeg.m: -------------------------------------------------------------------------------- 1 | (* ::Package:: *) 2 | 3 | (* Authors: 4 | Karolis Misiunas (km558@cam.ac.uk) 5 | Kenta Takagaki (github: ktakagaki) 6 | *) 7 | 8 | 9 | (* ::Text:: *) 10 | (**) 11 | 12 | 13 | (*The package provides methods for importing/exporting video using ffmpeg library. 14 | Problem with Mathematica's Import function is artefacts it produced using QuickTime. 15 | The aim of the library is to be as compatible as possible with original Mathematica's 16 | functions with prefix of FF... 17 | 18 | Designed for B&W videos. 19 | *) 20 | (*Version 1 (2014-05-07) - initial release. *) 21 | (*Version 2 (2014-08-21) - ffprobe and performace mode *) 22 | (*Version 3 (2015-03-09) - ffprobe no longer requires temporary files *) 23 | (*Version 4 (2015-11-20) - fix for mac os x, because streams used to break (in touch with Wolfram) *) 24 | (*Version 5 (2015-12-04) - ffmpeg with fast and accurate seek; ffprobe check with FFmpeg[] *) 25 | (*Version 5.1 (2016-01-08) - Added "ImageList" support as with Import *) 26 | (*Version 5.2 (2018-10-27) - Made method FFprobe public *) 27 | 28 | (* ::Section:: *) 29 | (* Package Declarations*) 30 | 31 | BeginPackage["FFmpeg`"]; 32 | 33 | 34 | FFImport::usage = 35 | "FFImport[\"file\", elements] loads the parameters necessary for the Import. 36 | If supplied with {\"Frames\", 1} or {\"Frames\", Range[]} it will use ffmpeg 37 | to fetch frames. Optimised for loading consecutive frames." 38 | 39 | FFmpeg::usage = 40 | "FFmpeg[] returns status of the plug-in. 41 | If text argument is supplied it is assumed to be path to ffmpeg." 42 | 43 | FFprobe::usage = 44 | "FFprobe[] returns status of ffprobe config. If string is passed, it will set the path." 45 | 46 | FFInputStreamAt::usage = 47 | "FFInputStreamAt[file_String, at_Integer, noOfFrames_Integer] returns {data stream, dimensions} 48 | where \"file\" is the file to be read, \"at\" specifies first frame to read, 49 | and \"noOfFrames\" gives number of frames to read (you can pass All command)." 50 | 51 | FFGetNextFrame::usage = 52 | "FFGetNextFrame[stream_, dim_] gives image of next frame for specified stream and dimensions." 53 | 54 | FFSkipFrame::usage = 55 | "FFSkipFrame[stream_, dim_, n_Integer:1] skips n frame of specified ffmpeg stream." 56 | 57 | FFImport::notSupported = "Command not supported by FFImport[], faling back to Import[]"; 58 | 59 | (* options associated*) 60 | Options[FFmpeg] = { 61 | "Colors" -> 3 (*number of color channels*), 62 | "ColorCommand" -> "rgb24" (*indicator for "-pix_fmt" parameter: gray/rgb24*) 63 | } 64 | 65 | 66 | (* ::Section:: *) 67 | (*Package Implementations*) 68 | 69 | 70 | Begin["`Private`"] 71 | 72 | 73 | (* ::Subsection::Closed:: *) 74 | (*FFmpeg Function*) 75 | 76 | 77 | (*set the path to ffmpeg*) 78 | FFmpeg[path_String] := (ffmpeg = path;) 79 | 80 | (*returns status of ffmpeg.*) 81 | (*todo: on windows it responds, but does not checkout.*) 82 | FFmpeg[] := 83 | ( 84 | If[ !StringQ@ffmpeg, 85 | Print @ "The path to ffmpeg is unknown. Use FFmpeg[\"path\"] to set it.", 86 | (*second option - test if working*) 87 | If[ StringMatchQ[ 88 | ToString @ ReadLine @ OpenRead["!" ~~ ffmpeg ~~ " -version", BinaryFormat -> True], 89 | "ffmpeg version*"], 90 | Print @ "ffmpeg was found and is functional", 91 | Print @ ("ffmpeg does not respond correctly. Please check the path: " <> ToString@ffmpeg) 92 | ] 93 | ]; FFprobe[]; ) 94 | 95 | (*run on loading - default path*) 96 | Switch[ $OperatingSystem, 97 | "MacOSX", FFmpeg @ "/usr/local/bin/ffmpeg", (*homebrew*) 98 | "Windows", FFmpeg @ "ffmpeg.exe", 99 | "Linux", FFmpeg @ "ffmpeg" ]; 100 | 101 | 102 | (* ::Subsection::Closed:: *) 103 | (*FFmpeg Implementation*) 104 | 105 | 106 | (*reads stream for next frame*) 107 | FFGetNextFrame[stream_, dim_] := 108 | Image[ 109 | Partition[ 110 | Partition[ 111 | BinaryReadList[stream, "Byte", OptionValue[FFmpeg, "Colors"]*dim[[1]]*dim[[2]] ] 112 | , OptionValue[FFmpeg, "Colors"] ] 113 | , dim[[1]] ] 114 | , "Byte"] 115 | 116 | (*skip frame*) 117 | FFSkipFrame[stream_, dim_, n_Integer:1] := 118 | Skip[ stream, Byte, OptionValue[FFmpeg, "Colors"]*n*dim[[1]]*dim[[2]] ] 119 | 120 | (*makes a stream*) 121 | (* special handler for MAC because there is an error for M9+ with pipes*) 122 | If[ $OperatingSystem == "MacOSX" && $VersionNumber >= 9, 123 | (*MAC OS X version*) 124 | (*most likely does not handle multiple files at the same time!!*) 125 | (*leaves pipe in /tmp/ folder *) 126 | (* TODO: still not working stability! *) 127 | Print["Warring! FFmpeg does not work well on Mathematica 9+ for Mac, because of pipe issues."]; 128 | ] 129 | 130 | (*makes a stream*) 131 | FFInputStreamAt[file_String, at_Integer, noOfFrames_Integer] := 132 | Module[{fps, startAtSec, st, dim, formatedFile}, 133 | formatedFile = "\"" ~~ file ~~ "\""; 134 | fps = FFImport[file, "FrameRate"]; 135 | dim = FFImport[file, "ImageSize"]; 136 | startAtSec = (at-1) / fps; 137 | st = OpenRead["!" ~~ ffmpeg ~~ 138 | " -ss " ~~ ToString[startAtSec] ~~ 139 | " -i " ~~ formatedFile ~~ 140 | " -frames:v " ~~ ToString@noOfFrames ~~ 141 | " -loglevel quiet" ~~ 142 | " -f image2pipe " ~~ 143 | " -pix_fmt " ~~ OptionValue[FFmpeg, "ColorCommand"] ~~ 144 | " -vcodec rawvideo" ~~ 145 | " - " , 146 | BinaryFormat -> True]; 147 | {st, dim} 148 | ] 149 | 150 | (*makes a stream with all the frames*) 151 | FFInputStreamAt[file_String, at_Integer, All] := 152 | FFInputStreamAt[file, at, FFImport[file, "FrameCount"]]; 153 | 154 | 155 | (*read one frame*) 156 | FFGetOneFrame[path_String, frame_Integer] := Module[ {st, dim, img}, 157 | {st, dim} = FFInputStreamAt[path, frame, 1]; 158 | img = FFGetNextFrame[st, dim]; 159 | Close[st]; 160 | img 161 | ] 162 | 163 | (*read multiple frames*) 164 | FFGetOneFrame[path_String, frames_List] := Module[ {order, st, dim, res, ReadFrames}, 165 | order = Sort @ frames; 166 | {st, dim} = FFInputStreamAt[path, First@order, Last@order - First@order+1]; 167 | ReadFrames[] := Reap@Do[ 168 | If[ MemberQ[order,f], 169 | Sow @ FFGetNextFrame[st, dim] , 170 | FFSkipFrame[st, dim] 171 | ] 172 | , {f, First@order, Last@order} 173 | ]; 174 | res = Check[ ReadFrames[], 175 | Close[st]; 176 | Print@"Failed loading frames. try again."; 177 | Return@FFGetOneFrame[path, frames]]; 178 | Close[st]; 179 | res[[2, 1]] (*extract result from reap*) 180 | ] 181 | 182 | (*read multiple frames - experimental*) 183 | FFGetOneFrameTest[path_String, frames_List] := Module[ {order, st, dim, res}, 184 | order = Sort @ frames; 185 | {st, dim} = FFInputStreamAtTest[path, First@order, Last@order - First@order+1]; 186 | res = Reap@Do[ 187 | If[ MemberQ[order,f], 188 | Sow @ FFGetNextFrame[st, dim] , 189 | FFGetNextFrame[st, dim] 190 | ] 191 | , {f, First@order, Last@order} 192 | ]; 193 | Print@"experimental frame grabber - ffmpeg"; 194 | Close[st]; 195 | res[[2, 1]] (*extract result from reap*) 196 | ] 197 | 198 | 199 | (* ::Subsection:: *) 200 | (*FFprobe Function/Implementation*) 201 | 202 | 203 | (*set the path to ffmpeg*) 204 | FFprobe[path_String] := (ffprobe = path;); 205 | 206 | 207 | (*returns status of ffmpeg.*) 208 | (*todo: on windows it responds, but does not checkout.*) 209 | FFprobe[] := 210 | If[ !StringQ@ffprobe, 211 | Print @ "The path to ffprobe is unknown. Use FFprobe[\"path\"] to set it.", 212 | (*second option - test if working*) 213 | If[ StringMatchQ[ 214 | ToString @ ReadLine @ OpenRead["!" ~~ ffprobe ~~ " -version", BinaryFormat -> True], 215 | "ffprobe version*"], 216 | Print @ "ffprobe was found and is functional", 217 | Print @ ("ffprobe does not respond correctly. Please check the path: " <> ToString@ffprobe) 218 | ] 219 | ]; 220 | 221 | (*run on loading - default path*) 222 | Switch[ $OperatingSystem, 223 | "MacOSX", FFprobe @ "/usr/local/bin/ffprobe", 224 | "Windows", FFprobe @ "ffprobe.exe", 225 | "Linux", FFprobe @ "ffprobe"]; 226 | 227 | 228 | FFProbe[file_String, streamCodec_String, targetVariable_String] := 229 | FFProbe[file, streamCodec, {targetVariable}][[1]]; 230 | 231 | 232 | FFProbe[file_String, streamCodec_String, {targetVariables__String}] := 233 | Module[ {tempFile, tempOutput}, 234 | tempOutput = Import["!" <> ffprobe <> 235 | " -loglevel panic -print_format json -show_format -show_streams \"" <> 236 | file <> "\"", "JSON"]; 237 | tempOutput = Cases[("streams" /. tempOutput),{___, "codec_type"->streamCodec, ___}]; 238 | If[ Length[tempOutput] >= 1, 239 | ToExpression[{targetVariables} /. tempOutput[[1]]], 240 | Message[FFGetFrameRate::noStream, streamCodec, file]; {} 241 | ] 242 | ]; 243 | 244 | FFProbe::noStream = "Could not find `1` stream in file `2`."; 245 | 246 | FFGetFrameRate[file_String] := N @ FFProbe[file, "video", "r_frame_rate"]; 247 | 248 | FFGetDuration[file_String] := N @ FFProbe[file, "video", "duration"]; 249 | 250 | FFGetImageSize[file_String] := FFProbe[file, "video", {"width","height"}]; 251 | 252 | 253 | 254 | 255 | (* ::Subsection:: *) 256 | (*FFImport Function (putting everything together)*) 257 | 258 | 259 | (* Importing function*) 260 | FFImport[path_String, elements_] := Switch[ elements, 261 | {"Frames", _Integer}, FFGetOneFrame[ path, elements[[2]] ], 262 | {"Frames", _List}, FFGetOneFrame[path, elements[[2]] ], 263 | {"Frames", _List, True}, FFGetOneFrameTest[path, elements[[2]] ], (*experimental*) 264 | {"ImageList", _Integer}, FFGetOneFrame[ path, elements[[2]] ], 265 | {"ImageList", _List}, FFGetOneFrame[path, elements[[2]] ], 266 | "FrameRate", FFGetFrameRate[path], 267 | "ImageSize", FFGetImageSize[path], 268 | "Duration", FFGetDuration[path], 269 | {"FrameRate"}, FFGetFrameRate[path], 270 | {"ImageSize"}, FFGetImageSize[path], 271 | {"Duration"}, FFGetDuration[path], 272 | 273 | _, Message[FFImport::notSupported, elements]; Import[path, elements] 274 | ]; 275 | 276 | 277 | 278 | (* todo in the future *) 279 | FFExport[path_String, expr_] := Print @ "not implemented"; 280 | 281 | 282 | (* ::Section:: *) 283 | (*Package Close*) 284 | 285 | 286 | End[ ] 287 | 288 | EndPackage[ ] 289 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Karolis Misiunas 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ffmpeg-mathematica 2 | ================== 3 | 4 | Mathematica package for using FFMPEG video library. This package accurately imports video frames into Mathematica. It is necessary for scientific applications as Mathematica's (v9 or v10) default methods uses QuickTime that produces artifact in uncompressed videos or duplicated frames. It also is useful for importing other video-codecs. 5 | 6 | ## Usage 7 | 8 | Mimicking Mathematica's Import function: 9 | `FFImport[ "file.avi", {"Frames", 1}]` - gives first frame (slow way) 10 | `FFImport[ "file.avi", {"Frames", Range[1,1000]}]` - gives first 1000 frames (fast) 11 | 12 | Also supports some property look-up functions using ffprobe: 13 | `FFImport[ "file.avi", "FrameRate"]` - returns the frame rate of the video 14 | `FFImport[ "file.avi", "Duration"]` - returns the duration of the video in sec 15 | `FFImport[ "file.avi", "ImageSize"]` - frame size in pixels 16 | 17 | 18 | To test status of ffmpeg library you can run `FFmpeg[]`. 19 | 20 | ## Installation 21 | 22 | You will need to add package via ```< 1 (*number of color channels*), 49 | "ColorCommand" -> "gray" (*indicator for "-pix_fmt" parameter:gray/ 50 | rgb24*) 51 | };` 52 | 53 | ## ToDo List and known bugs 54 | 55 | - There is sometimes an error loading the video - where the ffmpeg reports end of stream before entire video was loaded. On the internet there seems to be a suggestion that stream is not closed properly in Mathematica. Be careful! In my experience it is a problem with external USB hard-drives with MAC OS X. 56 | - the fast lookup is not implemented. It is slow to go though large videos to the right frame. Load video in big lumps to avoid this penalty. 57 | 58 | ## ToDo 59 | 60 | - Restructure to work with built in Import[] function. 61 | 62 | ## Contributors 63 | 64 | - Karolis Misiunas (github: kmisiunas) 65 | - Kenta Takagaki (github: ktakagaki) 66 | 67 | ## Help Improving it further! 68 | 69 | -------------------------------------------------------------------------------- /Tests/Test_Import_FFprobe_info.nb: -------------------------------------------------------------------------------- 1 | (* Content-type: application/vnd.wolfram.mathematica *) 2 | 3 | (*** Wolfram Notebook File ***) 4 | (* http://www.wolfram.com/nb *) 5 | 6 | (* CreatedBy='Mathematica 10.0' *) 7 | 8 | (*CacheID: 234*) 9 | (* Internal cache information: 10 | NotebookFileLineBreakTest 11 | NotebookFileLineBreakTest 12 | NotebookDataPosition[ 158, 7] 13 | NotebookDataLength[ 25500, 640] 14 | NotebookOptionsPosition[ 23203, 552] 15 | NotebookOutlinePosition[ 23546, 567] 16 | CellTagsIndexPosition[ 23503, 564] 17 | WindowFrame->Normal*) 18 | 19 | (* Beginning of Notebook Content *) 20 | Notebook[{ 21 | 22 | Cell[CellGroupData[{ 23 | Cell["FFMpeg ffprobe - related tests", "Title", 24 | CellChangeTimes->{{3.6176012593432617`*^9, 3.617601276687254*^9}}], 25 | 26 | Cell[CellGroupData[{ 27 | 28 | Cell[BoxData[ 29 | RowBox[{"FileNameJoin", "[", 30 | RowBox[{"{", 31 | RowBox[{"$TemporaryDirectory", ",", "\"\\""}], "}"}], 32 | "]"}]], "Input", 33 | CellChangeTimes->{{3.61744699212882*^9, 3.617447081937957*^9}, { 34 | 3.6174616745166044`*^9, 3.617461706018406*^9}, {3.6174622900288095`*^9, 35 | 3.617462290431833*^9}}], 36 | 37 | Cell[BoxData["\<\"C:\\\\Users\\\\Kenta\\\\AppData\\\\Local\\\\Temp\\\\\ 38 | tempFFmpeg.json\"\>"], "Output", 39 | CellChangeTimes->{{3.617446995715025*^9, 3.617447018845348*^9}, { 40 | 3.6174470497361145`*^9, 3.6174470822489743`*^9}, {3.6174616940937243`*^9, 41 | 3.6174617062524195`*^9}, 3.6174622909828644`*^9}] 42 | }, Open ]], 43 | 44 | Cell[CellGroupData[{ 45 | 46 | Cell["ffprobe (function path)", "Section", 47 | CellChangeTimes->{{3.617600159718367*^9, 3.6176001685878744`*^9}, { 48 | 3.6176011256856174`*^9, 3.617601127236706*^9}, {3.617601339411842*^9, 49 | 3.61760134305205*^9}}], 50 | 51 | Cell[BoxData[ 52 | RowBox[{"Needs", "[", "\"\\"", "]"}]], "Input"], 53 | 54 | Cell[CellGroupData[{ 55 | 56 | Cell[BoxData["$OperatingSystem"], "Input"], 57 | 58 | Cell[BoxData["\<\"Windows\"\>"], "Output", 59 | CellChangeTimes->{3.6176024207536907`*^9}] 60 | }, Open ]], 61 | 62 | Cell[CellGroupData[{ 63 | 64 | Cell[BoxData["FFmpeg`Private`ffprobe"], "Input", 65 | CellChangeTimes->{{3.617462187419941*^9, 3.617462188838022*^9}, { 66 | 3.6176024012465754`*^9, 3.617602406283863*^9}}], 67 | 68 | Cell[BoxData["\<\"ffprobe.exe\"\>"], "Output", 69 | CellChangeTimes->{ 70 | 3.6174621893320503`*^9, {3.6176013443701253`*^9, 3.617601350462474*^9}, 71 | 3.6176024082679768`*^9}] 72 | }, Open ]] 73 | }, Open ]], 74 | 75 | Cell[CellGroupData[{ 76 | 77 | Cell["\[OpenCurlyDoubleQuote]FrameRate\[CloseCurlyDoubleQuote]", "Section", 78 | CellChangeTimes->{{3.617600159718367*^9, 3.6176001685878744`*^9}, { 79 | 3.6176011256856174`*^9, 3.617601127236706*^9}}], 80 | 81 | Cell[BoxData[ 82 | RowBox[{"Needs", "[", "\"\\"", "]"}]], "Input", 83 | CellChangeTimes->{{3.6176002355587053`*^9, 3.617600240445985*^9}}], 84 | 85 | Cell[CellGroupData[{ 86 | 87 | Cell[BoxData[ 88 | RowBox[{"Import", "[", 89 | RowBox[{ 90 | "\"\\"", ",", " ", 91 | "\"\\""}], "]"}]], "Input", 92 | CellChangeTimes->{{3.61760019753353*^9, 3.617600207062075*^9}, { 93 | 3.61760113482414*^9, 3.6176011362632227`*^9}}], 94 | 95 | Cell[BoxData["10.`"], "Output", 96 | CellChangeTimes->{3.6176002151835394`*^9, 3.6176010226187224`*^9, 97 | 3.617601101837253*^9, 3.6176011424545765`*^9}] 98 | }, Open ]], 99 | 100 | Cell[CellGroupData[{ 101 | 102 | Cell[BoxData[ 103 | RowBox[{"FFImport", "[", 104 | RowBox[{ 105 | "\"\\"", ",", " ", 106 | "\"\\""}], "]"}]], "Input", 107 | CellChangeTimes->{{3.61760019753353*^9, 3.617600207062075*^9}, { 108 | 3.6176010966709576`*^9, 3.617601097911029*^9}, 3.6176011396564164`*^9}], 109 | 110 | Cell[BoxData[ 111 | RowBox[{"{", "10", "}"}]], "Output", 112 | CellChangeTimes->{3.6176011050024347`*^9, 3.6176011454907503`*^9, 113 | 3.617601220804058*^9}] 114 | }, Open ]] 115 | }, Closed]], 116 | 117 | Cell[CellGroupData[{ 118 | 119 | Cell["\[OpenCurlyDoubleQuote]ImageSize\[CloseCurlyDoubleQuote]", "Section", 120 | CellChangeTimes->{{3.617600159718367*^9, 3.6176001685878744`*^9}}], 121 | 122 | Cell[BoxData[ 123 | RowBox[{"Needs", "[", "\"\\"", "]"}]], "Input", 124 | CellChangeTimes->{{3.6176002355587053`*^9, 3.617600240445985*^9}}], 125 | 126 | Cell[CellGroupData[{ 127 | 128 | Cell[BoxData[ 129 | RowBox[{"Import", "[", 130 | RowBox[{ 131 | "\"\\"", ",", " ", 132 | "\"\\""}], "]"}]], "Input", 133 | CellChangeTimes->{{3.61760019753353*^9, 3.617600207062075*^9}}], 134 | 135 | Cell[BoxData[ 136 | RowBox[{"{", 137 | RowBox[{"160", ",", "120"}], "}"}]], "Output", 138 | CellChangeTimes->{3.6176002151835394`*^9, 3.6176010226187224`*^9, 139 | 3.617601101837253*^9}] 140 | }, Open ]], 141 | 142 | Cell[CellGroupData[{ 143 | 144 | Cell[BoxData[ 145 | RowBox[{"FFImport", "[", 146 | RowBox[{ 147 | "\"\\"", ",", " ", 148 | "\"\\""}], "]"}]], "Input", 149 | CellChangeTimes->{{3.61760019753353*^9, 3.617600207062075*^9}, { 150 | 3.6176010966709576`*^9, 3.617601097911029*^9}}], 151 | 152 | Cell[BoxData[ 153 | RowBox[{"{", 154 | RowBox[{"160", ",", "120"}], "}"}]], "Output", 155 | CellChangeTimes->{3.6176011050024347`*^9}] 156 | }, Open ]] 157 | }, Closed]], 158 | 159 | Cell[CellGroupData[{ 160 | 161 | Cell["\[OpenCurlyDoubleQuote]Duration\[CloseCurlyDoubleQuote]", "Section", 162 | CellChangeTimes->{{3.617600159718367*^9, 3.6176001685878744`*^9}, { 163 | 3.617602435980562*^9, 3.6176024372676353`*^9}}], 164 | 165 | Cell[BoxData[ 166 | RowBox[{"Needs", "[", "\"\\"", "]"}]], "Input", 167 | CellChangeTimes->{{3.6176002355587053`*^9, 3.617600240445985*^9}}], 168 | 169 | Cell[CellGroupData[{ 170 | 171 | Cell[BoxData[ 172 | RowBox[{"Import", "[", 173 | RowBox[{ 174 | "\"\\"", ",", " ", 175 | "\"\\""}], "]"}]], "Input", 176 | CellChangeTimes->{{3.61760019753353*^9, 3.617600207062075*^9}, { 177 | 3.617602442733948*^9, 3.6176024441170273`*^9}}], 178 | 179 | Cell[BoxData["8.9`"], "Output", 180 | CellChangeTimes->{3.6176002151835394`*^9, 3.6176010226187224`*^9, 181 | 3.617601101837253*^9, 3.6176024503573847`*^9}] 182 | }, Open ]], 183 | 184 | Cell[CellGroupData[{ 185 | 186 | Cell[BoxData[ 187 | RowBox[{"FFImport", "[", 188 | RowBox[{ 189 | "\"\\"", ",", " ", 190 | "\"\\""}], "]"}]], "Input", 191 | CellChangeTimes->{{3.61760019753353*^9, 3.617600207062075*^9}, { 192 | 3.6176010966709576`*^9, 3.617601097911029*^9}, {3.617602545205809*^9, 193 | 3.617602546211867*^9}}], 194 | 195 | Cell[BoxData["8.9`"], "Output", 196 | CellChangeTimes->{3.6176011050024347`*^9, 3.6176025529172506`*^9, 197 | 3.617602584587062*^9}] 198 | }, Open ]] 199 | }, Open ]], 200 | 201 | Cell[CellGroupData[{ 202 | 203 | Cell["Testing ffprobe output parsing", "Section", 204 | CellChangeTimes->{{3.617600159718367*^9, 3.6176001685878744`*^9}, { 205 | 3.617601304011817*^9, 3.617601312891325*^9}}], 206 | 207 | Cell[BoxData[ 208 | RowBox[{ 209 | RowBox[{"tempOutput", " ", "=", 210 | RowBox[{"{", 211 | RowBox[{ 212 | RowBox[{"\"\\"", "\[Rule]", 213 | RowBox[{"{", 214 | RowBox[{ 215 | RowBox[{"{", 216 | RowBox[{ 217 | RowBox[{ 218 | "\"\\"", "\[Rule]", "\"\\""}], ",", 219 | RowBox[{"\"\\"", "\[Rule]", "\"\<0x0161\>\""}], ",", 220 | RowBox[{"\"\\"", "\[Rule]", "\"\<0/0\>\""}], ",", 221 | RowBox[{"\"\\"", "\[Rule]", "\"\<1/44100\>\""}], 222 | ",", 223 | RowBox[{ 224 | "\"\\"", "\[Rule]", 225 | "\"\\""}], ",", 226 | RowBox[{"\"\\"", "\[Rule]", "0"}], ",", 227 | RowBox[{"\"\\"", "\[Rule]", "\"\\""}], ",", 228 | RowBox[{"\"\\"", "\[Rule]", 229 | RowBox[{"{", 230 | RowBox[{"\"\\"", "\[Rule]", "\"\\""}], "}"}]}], 231 | ",", 232 | RowBox[{"\"\\"", "\[Rule]", "\"\<160040\>\""}], ",", 233 | RowBox[{"\"\\"", "\[Rule]", "2"}], ",", 234 | RowBox[{"\"\\"", "\[Rule]", "0"}], ",", 235 | RowBox[{"\"\\"", "\[Rule]", "\"\\""}], ",", 236 | RowBox[{"\"\\"", "\[Rule]", "\"\\""}], ",", 237 | RowBox[{"\"\\"", "\[Rule]", "\"\<4619.780000\>\""}], ",", 238 | RowBox[{"\"\\"", "\[Rule]", "\"\<44100\>\""}], ",", 239 | RowBox[{"\"\\"", "\[Rule]", "\"\<0/0\>\""}], ",", 240 | RowBox[{"\"\\"", "\[Rule]", "\"\<1/1000\>\""}], ",", 241 | RowBox[{"\"\\"", "\[Rule]", "0"}], ",", 242 | RowBox[{"\"\\"", "\[Rule]", "\"\<0.000000\>\""}], ",", 243 | RowBox[{"\"\\"", "\[Rule]", 244 | RowBox[{"{", 245 | RowBox[{ 246 | RowBox[{"\"\\"", "\[Rule]", "0"}], ",", 247 | RowBox[{"\"\\"", "\[Rule]", "0"}], ",", 248 | RowBox[{"\"\\"", "\[Rule]", "0"}], ",", 249 | RowBox[{"\"\\"", "\[Rule]", "0"}], ",", 250 | RowBox[{"\"\\"", "\[Rule]", "0"}], ",", 251 | RowBox[{"\"\\"", "\[Rule]", "0"}], ",", 252 | RowBox[{"\"\\"", "\[Rule]", "0"}], ",", 253 | RowBox[{"\"\\"", "\[Rule]", "0"}], ",", 254 | RowBox[{"\"\\"", "\[Rule]", "0"}], ",", 255 | RowBox[{"\"\\"", "\[Rule]", "0"}], ",", 256 | RowBox[{"\"\\"", "\[Rule]", "0"}]}], "}"}]}], 257 | ",", 258 | RowBox[{"\"\\"", "\[Rule]", "4619780"}]}], "}"}], ",", 259 | RowBox[{"{", 260 | RowBox[{ 261 | RowBox[{"\"\\"", "\[Rule]", "\"\<1/1000\>\""}], 262 | ",", 263 | RowBox[{ 264 | "\"\\"", "\[Rule]", 265 | "\"\\""}], ",", 266 | RowBox[{"\"\\"", "\[Rule]", "\"\\""}], ",", 267 | RowBox[{"\"\\"", "\[Rule]", "0"}], ",", 268 | RowBox[{"\"\\"", "\[Rule]", "\"\\""}], ",", 269 | RowBox[{ 270 | "\"\\"", "\[Rule]", "\"\<25:14\>\""}], ",", 271 | RowBox[{"\"\\"", "\[Rule]", "\"\<15/1\>\""}], ",", 272 | RowBox[{"\"\\"", "\[Rule]", "\"\\""}], 273 | ",", 274 | RowBox[{"\"\\"", "\[Rule]", "\"\<0x33564d57\>\""}], ",", 275 | RowBox[{"\"\\"", "\[Rule]", "1"}], ",", 276 | RowBox[{"\"\\"", "\[Rule]", "448"}], ",", 277 | RowBox[{"\"\\"", "\[Rule]", "\"\\""}], ",", 278 | RowBox[{"\"\\"", "\[Rule]", "\"\\""}], ",", 279 | RowBox[{"\"\\"", "\[Rule]", "800"}], ",", 280 | RowBox[{"\"\\"", "\[Rule]", "\"\<1:1\>\""}], 281 | ",", 282 | RowBox[{"\"\\"", "\[Rule]", "4619780"}], ",", 283 | RowBox[{"\"\\"", "\[Rule]", 284 | RowBox[{"-", "99"}]}], ",", 285 | RowBox[{"\"\\"", "\[Rule]", "\"\<0/0\>\""}], ",", 286 | RowBox[{"\"\\"", "\[Rule]", "\"\<1/1000\>\""}], ",", 287 | RowBox[{"\"\\"", "\[Rule]", "186"}], ",", 288 | RowBox[{"\"\\"", "\[Rule]", "\"\<0.186000\>\""}], ",", 289 | RowBox[{"\"\\"", "\[Rule]", "\"\<4619.780000\>\""}], ",", 290 | RowBox[{"\"\\"", "\[Rule]", "\"\<1451149\>\""}], ",", 291 | RowBox[{"\"\\"", "\[Rule]", 292 | RowBox[{"{", 293 | RowBox[{ 294 | RowBox[{"\"\\"", "\[Rule]", "0"}], ",", 295 | RowBox[{"\"\\"", "\[Rule]", "0"}], ",", 296 | RowBox[{"\"\\"", "\[Rule]", "0"}], ",", 297 | RowBox[{"\"\\"", "\[Rule]", "0"}], ",", 298 | RowBox[{"\"\\"", "\[Rule]", "0"}], ",", 299 | RowBox[{"\"\\"", "\[Rule]", "0"}], ",", 300 | RowBox[{"\"\\"", "\[Rule]", "0"}], ",", 301 | RowBox[{"\"\\"", "\[Rule]", "0"}], ",", 302 | RowBox[{"\"\\"", "\[Rule]", "0"}], ",", 303 | RowBox[{"\"\\"", "\[Rule]", "0"}], ",", 304 | RowBox[{"\"\\"", "\[Rule]", "0"}]}], "}"}]}], 305 | ",", 306 | RowBox[{"\"\\"", "\[Rule]", 307 | RowBox[{"{", 308 | RowBox[{"\"\\"", "\[Rule]", "\"\\""}], "}"}]}]}], 309 | "}"}]}], "}"}]}], ",", 310 | RowBox[{"\"\\"", "\[Rule]", 311 | RowBox[{"{", 312 | RowBox[{ 313 | RowBox[{"\"\\"", "\[Rule]", 314 | RowBox[{"{", 315 | RowBox[{ 316 | RowBox[{"\"\\"", "\[Rule]", "\"\<0.0.0.0000\>\""}], 317 | ",", 318 | RowBox[{"\"\\"", "\[Rule]", "\"\<0\>\""}], ",", 319 | RowBox[{ 320 | "\"\\"", "\[Rule]", "\"\\""}], 321 | ",", 322 | RowBox[{ 323 | "\"\\"", "\[Rule]", "\"\<12.0.7601.17514\>\""}]}], 324 | "}"}]}], ",", 325 | RowBox[{"\"\\"", "\[Rule]", "0"}], ",", 326 | RowBox[{"\"\\"", "\[Rule]", "2"}], ",", 327 | RowBox[{ 328 | "\"\\"", "\[Rule]", 329 | "\"\\""}], ",", 331 | RowBox[{"\"\\"", "\[Rule]", "\"\<867273177\>\""}], ",", 332 | RowBox[{"\"\\"", "\[Rule]", "\"\\""}], ",", 333 | RowBox[{"\"\\"", "\[Rule]", "\"\<1501782\>\""}], ",", 334 | RowBox[{ 335 | "\"\\"", "\[Rule]", 336 | "\"\\""}], ",", 337 | RowBox[{"\"\\"", "\[Rule]", "\"\<0.000000\>\""}], ",", 338 | RowBox[{"\"\\"", "\[Rule]", "\"\<4619.966000\>\""}], ",", 339 | RowBox[{"\"\\"", "\[Rule]", "100"}]}], "}"}]}]}], 340 | "}"}]}], ";"}]], "Input", 341 | CellChangeTimes->{{3.6174621528659644`*^9, 3.6174621565041723`*^9}, { 342 | 3.6174624197352285`*^9, 3.6174624243974953`*^9}, {3.6174629754330125`*^9, 343 | 3.617462978203171*^9}}], 344 | 345 | Cell[BoxData[""], "Input", 346 | CellChangeTimes->{{3.6174629723318353`*^9, 3.617462972356837*^9}}], 347 | 348 | Cell[CellGroupData[{ 349 | 350 | Cell[BoxData[ 351 | RowBox[{"\"\\"", " ", "/.", " ", "tempOutput"}]], "Input", 352 | CellChangeTimes->{{3.617462429135766*^9, 3.617462491804351*^9}}], 353 | 354 | Cell[BoxData[ 355 | RowBox[{"{", 356 | RowBox[{ 357 | RowBox[{"{", 358 | RowBox[{ 359 | RowBox[{"\<\"codec_tag_string\"\>", "\[Rule]", "\<\"a[1][0][0]\"\>"}], 360 | ",", 361 | RowBox[{"\<\"codec_tag\"\>", "\[Rule]", "\<\"0x0161\"\>"}], ",", 362 | RowBox[{"\<\"r_frame_rate\"\>", "\[Rule]", "\<\"0/0\"\>"}], ",", 363 | RowBox[{"\<\"codec_time_base\"\>", "\[Rule]", "\<\"1/44100\"\>"}], ",", 364 | RowBox[{"\<\"codec_long_name\"\>", 365 | "\[Rule]", "\<\"Windows Media Audio 2\"\>"}], ",", 366 | RowBox[{"\<\"bits_per_sample\"\>", "\[Rule]", "0"}], ",", 367 | RowBox[{"\<\"codec_type\"\>", "\[Rule]", "\<\"audio\"\>"}], ",", 368 | RowBox[{"\<\"tags\"\>", "\[Rule]", 369 | RowBox[{"{", 370 | RowBox[{"\<\"language\"\>", "\[Rule]", "\<\"eng\"\>"}], "}"}]}], ",", 371 | RowBox[{"\<\"bit_rate\"\>", "\[Rule]", "\<\"160040\"\>"}], ",", 372 | RowBox[{"\<\"channels\"\>", "\[Rule]", "2"}], ",", 373 | RowBox[{"\<\"index\"\>", "\[Rule]", "0"}], ",", 374 | RowBox[{"\<\"codec_name\"\>", "\[Rule]", "\<\"wmav2\"\>"}], ",", 375 | RowBox[{"\<\"sample_fmt\"\>", "\[Rule]", "\<\"fltp\"\>"}], ",", 376 | RowBox[{"\<\"duration\"\>", "\[Rule]", "\<\"4619.780000\"\>"}], ",", 377 | RowBox[{"\<\"sample_rate\"\>", "\[Rule]", "\<\"44100\"\>"}], ",", 378 | RowBox[{"\<\"avg_frame_rate\"\>", "\[Rule]", "\<\"0/0\"\>"}], ",", 379 | RowBox[{"\<\"time_base\"\>", "\[Rule]", "\<\"1/1000\"\>"}], ",", 380 | RowBox[{"\<\"start_pts\"\>", "\[Rule]", "0"}], ",", 381 | RowBox[{"\<\"start_time\"\>", "\[Rule]", "\<\"0.000000\"\>"}], ",", 382 | RowBox[{"\<\"disposition\"\>", "\[Rule]", 383 | RowBox[{"{", 384 | RowBox[{ 385 | RowBox[{"\<\"lyrics\"\>", "\[Rule]", "0"}], ",", 386 | RowBox[{"\<\"forced\"\>", "\[Rule]", "0"}], ",", 387 | RowBox[{"\<\"default\"\>", "\[Rule]", "0"}], ",", 388 | RowBox[{"\<\"original\"\>", "\[Rule]", "0"}], ",", 389 | RowBox[{"\<\"clean_effects\"\>", "\[Rule]", "0"}], ",", 390 | RowBox[{"\<\"comment\"\>", "\[Rule]", "0"}], ",", 391 | RowBox[{"\<\"dub\"\>", "\[Rule]", "0"}], ",", 392 | RowBox[{"\<\"attached_pic\"\>", "\[Rule]", "0"}], ",", 393 | RowBox[{"\<\"karaoke\"\>", "\[Rule]", "0"}], ",", 394 | RowBox[{"\<\"visual_impaired\"\>", "\[Rule]", "0"}], ",", 395 | RowBox[{"\<\"hearing_impaired\"\>", "\[Rule]", "0"}]}], "}"}]}], ",", 396 | RowBox[{"\<\"duration_ts\"\>", "\[Rule]", "4619780"}]}], "}"}], ",", 397 | RowBox[{"{", 398 | RowBox[{ 399 | RowBox[{"\<\"codec_time_base\"\>", "\[Rule]", "\<\"1/1000\"\>"}], ",", 400 | RowBox[{"\<\"codec_long_name\"\>", 401 | "\[Rule]", "\<\"Windows Media Video 9\"\>"}], ",", 402 | RowBox[{"\<\"pix_fmt\"\>", "\[Rule]", "\<\"yuv420p\"\>"}], ",", 403 | RowBox[{"\<\"has_b_frames\"\>", "\[Rule]", "0"}], ",", 404 | RowBox[{"\<\"codec_type\"\>", "\[Rule]", "\<\"video\"\>"}], ",", 405 | RowBox[{"\<\"display_aspect_ratio\"\>", "\[Rule]", "\<\"25:14\"\>"}], 406 | ",", 407 | RowBox[{"\<\"r_frame_rate\"\>", "\[Rule]", "\<\"15/1\"\>"}], ",", 408 | RowBox[{"\<\"codec_tag_string\"\>", "\[Rule]", "\<\"WMV3\"\>"}], ",", 409 | RowBox[{"\<\"codec_tag\"\>", "\[Rule]", "\<\"0x33564d57\"\>"}], ",", 410 | RowBox[{"\<\"index\"\>", "\[Rule]", "1"}], ",", 411 | RowBox[{"\<\"height\"\>", "\[Rule]", "448"}], ",", 412 | RowBox[{"\<\"codec_name\"\>", "\[Rule]", "\<\"wmv3\"\>"}], ",", 413 | RowBox[{"\<\"profile\"\>", "\[Rule]", "\<\"Main\"\>"}], ",", 414 | RowBox[{"\<\"width\"\>", "\[Rule]", "800"}], ",", 415 | RowBox[{"\<\"sample_aspect_ratio\"\>", "\[Rule]", "\<\"1:1\"\>"}], ",", 416 | RowBox[{"\<\"duration_ts\"\>", "\[Rule]", "4619780"}], ",", 417 | RowBox[{"\<\"level\"\>", "\[Rule]", 418 | RowBox[{"-", "99"}]}], ",", 419 | RowBox[{"\<\"avg_frame_rate\"\>", "\[Rule]", "\<\"0/0\"\>"}], ",", 420 | RowBox[{"\<\"time_base\"\>", "\[Rule]", "\<\"1/1000\"\>"}], ",", 421 | RowBox[{"\<\"start_pts\"\>", "\[Rule]", "186"}], ",", 422 | RowBox[{"\<\"start_time\"\>", "\[Rule]", "\<\"0.186000\"\>"}], ",", 423 | RowBox[{"\<\"duration\"\>", "\[Rule]", "\<\"4619.780000\"\>"}], ",", 424 | RowBox[{"\<\"bit_rate\"\>", "\[Rule]", "\<\"1451149\"\>"}], ",", 425 | RowBox[{"\<\"disposition\"\>", "\[Rule]", 426 | RowBox[{"{", 427 | RowBox[{ 428 | RowBox[{"\<\"lyrics\"\>", "\[Rule]", "0"}], ",", 429 | RowBox[{"\<\"forced\"\>", "\[Rule]", "0"}], ",", 430 | RowBox[{"\<\"default\"\>", "\[Rule]", "0"}], ",", 431 | RowBox[{"\<\"original\"\>", "\[Rule]", "0"}], ",", 432 | RowBox[{"\<\"clean_effects\"\>", "\[Rule]", "0"}], ",", 433 | RowBox[{"\<\"comment\"\>", "\[Rule]", "0"}], ",", 434 | RowBox[{"\<\"dub\"\>", "\[Rule]", "0"}], ",", 435 | RowBox[{"\<\"attached_pic\"\>", "\[Rule]", "0"}], ",", 436 | RowBox[{"\<\"karaoke\"\>", "\[Rule]", "0"}], ",", 437 | RowBox[{"\<\"visual_impaired\"\>", "\[Rule]", "0"}], ",", 438 | RowBox[{"\<\"hearing_impaired\"\>", "\[Rule]", "0"}]}], "}"}]}], ",", 439 | RowBox[{"\<\"tags\"\>", "\[Rule]", 440 | RowBox[{"{", 441 | RowBox[{"\<\"language\"\>", "\[Rule]", "\<\"eng\"\>"}], "}"}]}]}], 442 | "}"}]}], "}"}]], "Output", 443 | CellChangeTimes->{{3.6174624489188976`*^9, 3.617462492096367*^9}}] 444 | }, Open ]], 445 | 446 | Cell[CellGroupData[{ 447 | 448 | Cell[BoxData[ 449 | RowBox[{ 450 | RowBox[{"Cases", "[", " ", 451 | RowBox[{ 452 | RowBox[{"\"\\"", " ", "/.", " ", "tempOutput"}], ",", " ", 453 | RowBox[{"{", 454 | RowBox[{"___", ",", " ", 455 | RowBox[{"\"\\"", "\[Rule]", "\"\\""}], ",", " ", 456 | "___"}], "}"}]}], "]"}], "[", 457 | RowBox[{"[", "1", "]"}], "]"}]], "Input", 458 | CellChangeTimes->{{3.617462429135766*^9, 3.617462532243664*^9}, { 459 | 3.617462591748067*^9, 3.6174626231498632`*^9}}], 460 | 461 | Cell[BoxData[ 462 | RowBox[{"{", 463 | RowBox[{ 464 | RowBox[{"\<\"codec_time_base\"\>", "\[Rule]", "\<\"1/1000\"\>"}], ",", 465 | RowBox[{"\<\"codec_long_name\"\>", 466 | "\[Rule]", "\<\"Windows Media Video 9\"\>"}], ",", 467 | RowBox[{"\<\"pix_fmt\"\>", "\[Rule]", "\<\"yuv420p\"\>"}], ",", 468 | RowBox[{"\<\"has_b_frames\"\>", "\[Rule]", "0"}], ",", 469 | RowBox[{"\<\"codec_type\"\>", "\[Rule]", "\<\"video\"\>"}], ",", 470 | RowBox[{"\<\"display_aspect_ratio\"\>", "\[Rule]", "\<\"25:14\"\>"}], ",", 471 | RowBox[{"\<\"r_frame_rate\"\>", "\[Rule]", "\<\"15/1\"\>"}], ",", 472 | RowBox[{"\<\"codec_tag_string\"\>", "\[Rule]", "\<\"WMV3\"\>"}], ",", 473 | RowBox[{"\<\"codec_tag\"\>", "\[Rule]", "\<\"0x33564d57\"\>"}], ",", 474 | RowBox[{"\<\"index\"\>", "\[Rule]", "1"}], ",", 475 | RowBox[{"\<\"height\"\>", "\[Rule]", "448"}], ",", 476 | RowBox[{"\<\"codec_name\"\>", "\[Rule]", "\<\"wmv3\"\>"}], ",", 477 | RowBox[{"\<\"profile\"\>", "\[Rule]", "\<\"Main\"\>"}], ",", 478 | RowBox[{"\<\"width\"\>", "\[Rule]", "800"}], ",", 479 | RowBox[{"\<\"sample_aspect_ratio\"\>", "\[Rule]", "\<\"1:1\"\>"}], ",", 480 | RowBox[{"\<\"duration_ts\"\>", "\[Rule]", "4619780"}], ",", 481 | RowBox[{"\<\"level\"\>", "\[Rule]", 482 | RowBox[{"-", "99"}]}], ",", 483 | RowBox[{"\<\"avg_frame_rate\"\>", "\[Rule]", "\<\"0/0\"\>"}], ",", 484 | RowBox[{"\<\"time_base\"\>", "\[Rule]", "\<\"1/1000\"\>"}], ",", 485 | RowBox[{"\<\"start_pts\"\>", "\[Rule]", "186"}], ",", 486 | RowBox[{"\<\"start_time\"\>", "\[Rule]", "\<\"0.186000\"\>"}], ",", 487 | RowBox[{"\<\"duration\"\>", "\[Rule]", "\<\"4619.780000\"\>"}], ",", 488 | RowBox[{"\<\"bit_rate\"\>", "\[Rule]", "\<\"1451149\"\>"}], ",", 489 | RowBox[{"\<\"disposition\"\>", "\[Rule]", 490 | RowBox[{"{", 491 | RowBox[{ 492 | RowBox[{"\<\"lyrics\"\>", "\[Rule]", "0"}], ",", 493 | RowBox[{"\<\"forced\"\>", "\[Rule]", "0"}], ",", 494 | RowBox[{"\<\"default\"\>", "\[Rule]", "0"}], ",", 495 | RowBox[{"\<\"original\"\>", "\[Rule]", "0"}], ",", 496 | RowBox[{"\<\"clean_effects\"\>", "\[Rule]", "0"}], ",", 497 | RowBox[{"\<\"comment\"\>", "\[Rule]", "0"}], ",", 498 | RowBox[{"\<\"dub\"\>", "\[Rule]", "0"}], ",", 499 | RowBox[{"\<\"attached_pic\"\>", "\[Rule]", "0"}], ",", 500 | RowBox[{"\<\"karaoke\"\>", "\[Rule]", "0"}], ",", 501 | RowBox[{"\<\"visual_impaired\"\>", "\[Rule]", "0"}], ",", 502 | RowBox[{"\<\"hearing_impaired\"\>", "\[Rule]", "0"}]}], "}"}]}], ",", 503 | RowBox[{"\<\"tags\"\>", "\[Rule]", 504 | RowBox[{"{", 505 | RowBox[{"\<\"language\"\>", "\[Rule]", "\<\"eng\"\>"}], "}"}]}]}], 506 | "}"}]], "Output", 507 | CellChangeTimes->{{3.6174626172035227`*^9, 3.6174626235038834`*^9}}] 508 | }, Open ]], 509 | 510 | Cell[CellGroupData[{ 511 | 512 | Cell[BoxData[ 513 | RowBox[{"\"\\"", " ", "/.", " ", 514 | RowBox[{ 515 | RowBox[{"Cases", "[", " ", 516 | RowBox[{ 517 | RowBox[{"\"\\"", " ", "/.", " ", "tempOutput"}], ",", " ", 518 | RowBox[{"{", 519 | RowBox[{"___", ",", " ", 520 | RowBox[{"\"\\"", "\[Rule]", "\"\\""}], ",", " ", 521 | "___"}], "}"}]}], "]"}], "[", 522 | RowBox[{"[", "1", "]"}], "]"}]}]], "Input", 523 | CellChangeTimes->{{3.617462429135766*^9, 3.617462532243664*^9}, { 524 | 3.617462591748067*^9, 3.617462655332704*^9}}], 525 | 526 | Cell[BoxData["\<\"15/1\"\>"], "Output", 527 | CellChangeTimes->{3.617462655656722*^9}] 528 | }, Open ]], 529 | 530 | Cell[CellGroupData[{ 531 | 532 | Cell[BoxData[ 533 | RowBox[{"ToExpression", "[", 534 | RowBox[{"\"\\"", " ", "/.", " ", 535 | RowBox[{ 536 | RowBox[{"Cases", "[", " ", 537 | RowBox[{ 538 | RowBox[{"\"\\"", " ", "/.", " ", "tempOutput"}], ",", " ", 539 | RowBox[{"{", 540 | RowBox[{"___", ",", " ", 541 | RowBox[{"\"\\"", "\[Rule]", "\"\\""}], ",", " ", 542 | "___"}], "}"}]}], "]"}], "[", 543 | RowBox[{"[", "1", "]"}], "]"}]}], "]"}]], "Input", 544 | CellChangeTimes->{{3.617462429135766*^9, 3.617462532243664*^9}, { 545 | 3.617462591748067*^9, 3.61746266610132*^9}}], 546 | 547 | Cell[BoxData["15"], "Output", 548 | CellChangeTimes->{3.6174626664083376`*^9}] 549 | }, Open ]] 550 | }, Open ]] 551 | }, Open ]] 552 | }, 553 | WindowSize->{952, 1154}, 554 | WindowMargins->{{0, Automatic}, {Automatic, 1148}}, 555 | FrontEndVersion->"10.0 for Microsoft Windows (64-bit) (July 1, 2014)", 556 | StyleDefinitions->"Default.nb" 557 | ] 558 | (* End of Notebook Content *) 559 | 560 | (* Internal cache information *) 561 | (*CellTagsOutline 562 | CellTagsIndex->{} 563 | *) 564 | (*CellTagsIndex 565 | CellTagsIndex->{} 566 | *) 567 | (*NotebookFileOutline 568 | Notebook[{ 569 | Cell[CellGroupData[{ 570 | Cell[580, 22, 115, 1, 90, "Title"], 571 | Cell[CellGroupData[{ 572 | Cell[720, 27, 322, 7, 31, "Input"], 573 | Cell[1045, 36, 302, 4, 31, "Output"] 574 | }, Open ]], 575 | Cell[CellGroupData[{ 576 | Cell[1384, 45, 209, 3, 63, "Section"], 577 | Cell[1596, 50, 72, 1, 31, "Input"], 578 | Cell[CellGroupData[{ 579 | Cell[1693, 55, 42, 0, 31, "Input"], 580 | Cell[1738, 57, 86, 1, 31, "Output"] 581 | }, Open ]], 582 | Cell[CellGroupData[{ 583 | Cell[1861, 63, 165, 2, 31, "Input"], 584 | Cell[2029, 67, 169, 3, 31, "Output"] 585 | }, Open ]] 586 | }, Open ]], 587 | Cell[CellGroupData[{ 588 | Cell[2247, 76, 194, 2, 63, "Section"], 589 | Cell[2444, 80, 140, 2, 31, "Input"], 590 | Cell[CellGroupData[{ 591 | Cell[2609, 86, 270, 6, 31, "Input"], 592 | Cell[2882, 94, 148, 2, 31, "Output"] 593 | }, Open ]], 594 | Cell[CellGroupData[{ 595 | Cell[3067, 101, 298, 6, 31, "Input"], 596 | Cell[3368, 109, 144, 3, 31, "Output"] 597 | }, Open ]] 598 | }, Closed]], 599 | Cell[CellGroupData[{ 600 | Cell[3561, 118, 143, 1, 49, "Section"], 601 | Cell[3707, 121, 140, 2, 31, "Input"], 602 | Cell[CellGroupData[{ 603 | Cell[3872, 127, 220, 5, 31, "Input"], 604 | Cell[4095, 134, 170, 4, 31, "Output"] 605 | }, Open ]], 606 | Cell[CellGroupData[{ 607 | Cell[4302, 143, 273, 6, 31, "Input"], 608 | Cell[4578, 151, 121, 3, 31, "Output"] 609 | }, Open ]] 610 | }, Closed]], 611 | Cell[CellGroupData[{ 612 | Cell[4748, 160, 193, 2, 49, "Section"], 613 | Cell[4944, 164, 140, 2, 31, "Input"], 614 | Cell[CellGroupData[{ 615 | Cell[5109, 170, 270, 6, 31, "Input"], 616 | Cell[5382, 178, 148, 2, 31, "Output"] 617 | }, Open ]], 618 | Cell[CellGroupData[{ 619 | Cell[5567, 185, 321, 7, 31, "Input"], 620 | Cell[5891, 194, 124, 2, 64, "Output"] 621 | }, Open ]] 622 | }, Open ]], 623 | Cell[CellGroupData[{ 624 | Cell[6064, 202, 166, 2, 63, "Section"], 625 | Cell[6233, 206, 7243, 136, 552, "Input"], 626 | Cell[13479, 344, 94, 1, 31, "Input"], 627 | Cell[CellGroupData[{ 628 | Cell[13598, 349, 149, 2, 31, "Input"], 629 | Cell[13750, 353, 5006, 89, 272, "Output"] 630 | }, Open ]], 631 | Cell[CellGroupData[{ 632 | Cell[18793, 447, 463, 11, 31, "Input"], 633 | Cell[19259, 460, 2579, 46, 152, "Output"] 634 | }, Open ]], 635 | Cell[CellGroupData[{ 636 | Cell[21875, 511, 522, 12, 31, "Input"], 637 | Cell[22400, 525, 81, 1, 31, "Output"] 638 | }, Open ]], 639 | Cell[CellGroupData[{ 640 | Cell[22518, 531, 569, 13, 52, "Input"], 641 | Cell[23090, 546, 73, 1, 31, "Output"] 642 | }, Open ]] 643 | }, Open ]] 644 | }, Open ]] 645 | } 646 | ] 647 | *) 648 | 649 | (* End of internal cache information *) 650 | -------------------------------------------------------------------------------- /Tests/tempFFprobe.log: -------------------------------------------------------------------------------- 1 | { 2 | "streams": [ 3 | { 4 | "index": 0, 5 | "codec_name": "wmav2", 6 | "codec_long_name": "Windows Media Audio 2", 7 | "codec_type": "audio", 8 | "codec_time_base": "1/44100", 9 | "codec_tag_string": "a[1][0][0]", 10 | "codec_tag": "0x0161", 11 | "sample_fmt": "fltp", 12 | "sample_rate": "44100", 13 | "channels": 2, 14 | "bits_per_sample": 0, 15 | "r_frame_rate": "0/0", 16 | "avg_frame_rate": "0/0", 17 | "time_base": "1/1000", 18 | "start_pts": 0, 19 | "start_time": "0.000000", 20 | "duration_ts": 3032614, 21 | "duration": "3032.614000", 22 | "bit_rate": "160040", 23 | "disposition": { 24 | "default": 0, 25 | "dub": 0, 26 | "original": 0, 27 | "comment": 0, 28 | "lyrics": 0, 29 | "karaoke": 0, 30 | "forced": 0, 31 | "hearing_impaired": 0, 32 | "visual_impaired": 0, 33 | "clean_effects": 0, 34 | "attached_pic": 0 35 | }, 36 | "tags": { 37 | "language": "eng" 38 | } 39 | }, 40 | { 41 | "index": 1, 42 | "codec_name": "wmv3", 43 | "codec_long_name": "Windows Media Video 9", 44 | "profile": "Main", 45 | "codec_type": "video", 46 | "codec_time_base": "1/1000", 47 | "codec_tag_string": "WMV3", 48 | "codec_tag": "0x33564d57", 49 | "width": 800, 50 | "height": 448, 51 | "has_b_frames": 0, 52 | "sample_aspect_ratio": "1:1", 53 | "display_aspect_ratio": "25:14", 54 | "pix_fmt": "yuv420p", 55 | "level": -99, 56 | "r_frame_rate": "15/1", 57 | "avg_frame_rate": "0/0", 58 | "time_base": "1/1000", 59 | "start_pts": 172, 60 | "start_time": "0.172000", 61 | "duration_ts": 3032614, 62 | "duration": "3032.614000", 63 | "bit_rate": "1451149", 64 | "disposition": { 65 | "default": 0, 66 | "dub": 0, 67 | "original": 0, 68 | "comment": 0, 69 | "lyrics": 0, 70 | "karaoke": 0, 71 | "forced": 0, 72 | "hearing_impaired": 0, 73 | "visual_impaired": 0, 74 | "clean_effects": 0, 75 | "attached_pic": 0 76 | }, 77 | "tags": { 78 | "language": "eng" 79 | } 80 | } 81 | ], 82 | "format": { 83 | "filename": "2014-08-10 19-03-50.633.wmv", 84 | "nb_streams": 2, 85 | "nb_programs": 0, 86 | "format_name": "asf", 87 | "format_long_name": "ASF (Advanced / Active Streaming Format)", 88 | "start_time": "0.000000", 89 | "duration": "3032.786000", 90 | "size": "613855655", 91 | "bit_rate": "1619252", 92 | "probe_score": 100, 93 | "tags": { 94 | "WMFSDKNeeded": "0.0.0.0000", 95 | "DeviceConformanceTemplate": "MP@HL", 96 | "WMFSDKVersion": "12.0.7601.17514", 97 | "IsVBR": "0" 98 | } 99 | } 100 | } 101 | --------------------------------------------------------------------------------