flutter_ffmpeg_example.dart 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631
  1. import 'dart:async';
  2. import 'dart:io';
  3. import 'package:flutter/material.dart';
  4. import 'package:flutter/services.dart';
  5. import 'package:flutter_ffmpeg/flutter_ffmpeg.dart';
  6. import 'package:flutter_ffmpeg/log_level.dart';
  7. import 'package:path/path.dart';
  8. import 'package:path_provider/path_provider.dart';
  9. void main() => runApp(FlutterFFmpegTestApp());
  10. class FlutterFFmpegTestApp extends StatelessWidget {
  11. @override
  12. Widget build(BuildContext context) {
  13. return MaterialApp(
  14. theme: ThemeData(
  15. primaryColor: Color(0xFFF46842),
  16. ),
  17. home: MainPage(),
  18. );
  19. }
  20. }
  21. class MainPage extends StatefulWidget {
  22. @override
  23. FlutterFFmpegTestAppState createState() => new FlutterFFmpegTestAppState();
  24. }
  25. class DecoratedTabBar extends StatelessWidget implements PreferredSizeWidget {
  26. DecoratedTabBar({@required this.tabBar, @required this.decoration});
  27. final TabBar tabBar;
  28. final BoxDecoration decoration;
  29. @override
  30. Size get preferredSize => tabBar.preferredSize;
  31. @override
  32. Widget build(BuildContext context) {
  33. return Stack(
  34. children: [
  35. Positioned.fill(child: Container(decoration: decoration)),
  36. tabBar,
  37. ],
  38. );
  39. }
  40. }
  41. class VideoUtil {
  42. static Future<Directory> get tempDirectory async {
  43. return await getTemporaryDirectory();
  44. }
  45. static Future<File> copyFileAssets(String assetName, String localName) async {
  46. final ByteData assetByteData = await rootBundle.load(assetName);
  47. final List<int> byteList = assetByteData.buffer.asUint8List(assetByteData.offsetInBytes, assetByteData.lengthInBytes);
  48. final String fullTemporaryPath = join((await tempDirectory).path, localName);
  49. return new File(fullTemporaryPath).writeAsBytes(byteList, mode: FileMode.writeOnly, flush: true);
  50. }
  51. static Future<String> assetPath(String assetName) async {
  52. return join((await tempDirectory).path, assetName);
  53. }
  54. static String generateEncodeVideoScript(String image1Path, String image2Path, String image3Path, String videoFilePath, String videoCodec, String customOptions) {
  55. return "-hide_banner -y -loop 1 -i " +
  56. image1Path +
  57. " " +
  58. "-loop 1 -i " +
  59. image2Path +
  60. " " +
  61. "-loop 1 -i " +
  62. image3Path +
  63. " " +
  64. "-filter_complex " +
  65. "[0:v]setpts=PTS-STARTPTS,scale=w=\'if(gte(iw/ih,640/427),min(iw,640),-1)\':h=\'if(gte(iw/ih,640/427),-1,min(ih,427))\',scale=trunc(iw/2)*2:trunc(ih/2)*2,setsar=sar=1/1,split=2[stream1out1][stream1out2];" +
  66. "[1:v]setpts=PTS-STARTPTS,scale=w=\'if(gte(iw/ih,640/427),min(iw,640),-1)\':h=\'if(gte(iw/ih,640/427),-1,min(ih,427))\',scale=trunc(iw/2)*2:trunc(ih/2)*2,setsar=sar=1/1,split=2[stream2out1][stream2out2];" +
  67. "[2:v]setpts=PTS-STARTPTS,scale=w=\'if(gte(iw/ih,640/427),min(iw,640),-1)\':h=\'if(gte(iw/ih,640/427),-1,min(ih,427))\',scale=trunc(iw/2)*2:trunc(ih/2)*2,setsar=sar=1/1,split=2[stream3out1][stream3out2];" +
  68. "[stream1out1]pad=width=640:height=427:x=(640-iw)/2:y=(427-ih)/2:color=#00000000,trim=duration=3,select=lte(n\\,90)[stream1overlaid];" +
  69. "[stream1out2]pad=width=640:height=427:x=(640-iw)/2:y=(427-ih)/2:color=#00000000,trim=duration=1,select=lte(n\\,30)[stream1ending];" +
  70. "[stream2out1]pad=width=640:height=427:x=(640-iw)/2:y=(427-ih)/2:color=#00000000,trim=duration=2,select=lte(n\\,60)[stream2overlaid];" +
  71. "[stream2out2]pad=width=640:height=427:x=(640-iw)/2:y=(427-ih)/2:color=#00000000,trim=duration=1,select=lte(n\\,30),split=2[stream2starting][stream2ending];" +
  72. "[stream3out1]pad=width=640:height=427:x=(640-iw)/2:y=(427-ih)/2:color=#00000000,trim=duration=2,select=lte(n\\,60)[stream3overlaid];" +
  73. "[stream3out2]pad=width=640:height=427:x=(640-iw)/2:y=(427-ih)/2:color=#00000000,trim=duration=1,select=lte(n\\,30)[stream3starting];" +
  74. "[stream2starting][stream1ending]blend=all_expr=\'if(gte(X,(W/2)*T/1)*lte(X,W-(W/2)*T/1),B,A)\':shortest=1[stream2blended];" +
  75. "[stream3starting][stream2ending]blend=all_expr=\'if(gte(X,(W/2)*T/1)*lte(X,W-(W/2)*T/1),B,A)\':shortest=1[stream3blended];" +
  76. "[stream1overlaid][stream2blended][stream2overlaid][stream3blended][stream3overlaid]concat=n=5:v=1:a=0,scale=w=640:h=424,format=yuv420p[video]" +
  77. " -map [video] -vsync 2 -async 1 " +
  78. customOptions +
  79. "-c:v " +
  80. videoCodec +
  81. " -r 30 " +
  82. videoFilePath;
  83. }
  84. }
  85. class FlutterFFmpegTestAppState extends State<MainPage> with TickerProviderStateMixin {
  86. static const String ASSET_1 = "1.jpg";
  87. static const String ASSET_2 = "2.jpg";
  88. static const String ASSET_3 = "3.jpg";
  89. final FlutterFFmpeg _flutterFFmpeg = new FlutterFFmpeg();
  90. TextEditingController _commandController;
  91. TabController _controller;
  92. String _commandOutput;
  93. String _encodeOutput;
  94. String _currentCodec;
  95. List<DropdownMenuItem<String>> _codecDropDownMenuItems;
  96. @override
  97. void initState() {
  98. super.initState();
  99. _commandController = TextEditingController();
  100. _controller = TabController(length: 2, vsync: this);
  101. _commandOutput = "";
  102. _encodeOutput = "";
  103. _codecDropDownMenuItems = _getCodecDropDownMenuItems();
  104. _currentCodec = _codecDropDownMenuItems[0].value;
  105. startupTests();
  106. prepareAssets();
  107. }
  108. void startupTests() {
  109. getFFmpegVersion().then((version) => print("FFmpeg version: $version"));
  110. getPlatform().then((platform) => print("Platform: $platform"));
  111. getLogLevel().then((level) => print("Old log level: " + LogLevel.levelToString(level)));
  112. setLogLevel(LogLevel.AV_LOG_INFO);
  113. getLogLevel().then((level) => print("New log level: " + LogLevel.levelToString(level)));
  114. getPackageName().then((packageName) => print("Package name: $packageName"));
  115. getExternalLibraries().then((packageList) {
  116. packageList.forEach((value) => print("External library: $value"));
  117. });
  118. }
  119. void prepareAssets() {
  120. VideoUtil.copyFileAssets('assets/pyramid.jpg', ASSET_1).then((path) => print('Loaded asset $path.'));
  121. VideoUtil.copyFileAssets('assets/colosseum.jpg', ASSET_2).then((path) => print('Loaded asset $path.'));
  122. VideoUtil.copyFileAssets('assets/tajmahal.jpg', ASSET_3).then((path) => print('Loaded asset $path.'));
  123. }
  124. void testRunCommand() {
  125. getLastReturnCode().then((rc) => print("Last rc: $rc"));
  126. getLastCommandOutput().then((output) => print("Last command output: $output"));
  127. print("Testing COMMAND.");
  128. // ENABLE LOG CALLBACK ON EACH CALL
  129. _flutterFFmpeg.enableLogCallback(commandOutputLogCallback);
  130. _flutterFFmpeg.enableStatisticsCallback(statisticsCallback);
  131. // CLEAR OUTPUT ON EACH EXECUTION
  132. _commandOutput = "";
  133. // COMMENT OPTIONAL TESTS
  134. // VideoUtil.tempDirectory.then((tempDirectory) {
  135. // Map<String, String> mapNameMap = new Map();
  136. // mapNameMap["my_custom_font"] = "my custom font";
  137. // setFontDirectory(tempDirectory.path, null);
  138. // });
  139. VideoUtil.tempDirectory.then((tempDirectory) {
  140. setFontconfigConfigurationPath(tempDirectory.path);
  141. });
  142. // disableRedirection();
  143. // disableLogs();
  144. // enableLogs();
  145. // execute(_commandController.text).then((rc) => print("FFmpeg process exited with rc $rc"));
  146. // executeWithDelimiter(_commandController.text, "_").then((rc) => print("FFmpeg process exited with rc $rc") );
  147. executeWithArguments(_commandController.text.split(" ")).then((rc) => print("FFmpeg process exited with rc $rc"));
  148. setState(() {});
  149. }
  150. void testGetMediaInformation(String mediaPath) {
  151. print("Testing Get Media Information.");
  152. // ENABLE LOG CALLBACK ON EACH CALL
  153. _flutterFFmpeg.enableLogCallback(commandOutputLogCallback);
  154. _flutterFFmpeg.enableStatisticsCallback(null);
  155. // CLEAR OUTPUT ON EACH EXECUTION
  156. _commandOutput = "";
  157. VideoUtil.assetPath(mediaPath).then((image1Path) {
  158. getMediaInformation(image1Path).then((info) {
  159. print('Media Information');
  160. print('Path: ${info['path']}');
  161. print('Format: ${info['format']}');
  162. print('Duration: ${info['duration']}');
  163. print('Start time: ${info['startTime']}');
  164. print('Bitrate: ${info['bitrate']}');
  165. if (info['streams'] != null) {
  166. final streamsInfoArray = info['streams'];
  167. if (streamsInfoArray.length > 0) {
  168. for (var streamsInfo in streamsInfoArray) {
  169. print('Stream id: ${streamsInfo['index']}');
  170. print('Stream type: ${streamsInfo['type']}');
  171. print('Stream codec: ${streamsInfo['codec']}');
  172. print('Stream full codec: ${streamsInfo['fullCodec']}');
  173. print('Stream format: ${streamsInfo['format']}');
  174. print('Stream full format: ${streamsInfo['fullFormat']}');
  175. print('Stream width: ${streamsInfo['width']}');
  176. print('Stream height: ${streamsInfo['height']}');
  177. print('Stream bitrate: ${streamsInfo['bitrate']}');
  178. print('Stream sample rate: ${streamsInfo['sampleRate']}');
  179. print('Stream sample format: ${streamsInfo['sampleFormat']}');
  180. print('Stream channel layout: ${streamsInfo['channelLayout']}');
  181. print('Stream sar: ${streamsInfo['sampleAspectRatio']}');
  182. print('Stream dar: ${streamsInfo['displayAspectRatio']}');
  183. print('Stream average frame rate: ${streamsInfo['averageFrameRate']}');
  184. print('Stream real frame rate: ${streamsInfo['realFrameRate']}');
  185. print('Stream time base: ${streamsInfo['timeBase']}');
  186. print('Stream codec time base: ${streamsInfo['codecTimeBase']}');
  187. }
  188. }
  189. }
  190. });
  191. });
  192. setState(() {});
  193. }
  194. void testEncodeVideo() {
  195. print("Testing VIDEO.");
  196. // ENABLE LOG CALLBACK ON EACH CALL
  197. _flutterFFmpeg.enableLogCallback(encodeOutputLogCallback);
  198. _flutterFFmpeg.enableStatisticsCallback(statisticsCallback);
  199. // CLEAR OUTPUT ON EACH EXECUTION
  200. _encodeOutput = "";
  201. disableStatistics();
  202. enableStatistics();
  203. VideoUtil.assetPath(ASSET_1).then((image1Path) {
  204. VideoUtil.assetPath(ASSET_2).then((image2Path) {
  205. VideoUtil.assetPath(ASSET_3).then((image3Path) {
  206. final String videoPath = getVideoPath();
  207. final String customOptions = getCustomEncodingOptions();
  208. final String ffmpegCodec = getFFmpegCodecName();
  209. VideoUtil.assetPath(videoPath).then((fullVideoPath) {
  210. execute(VideoUtil.generateEncodeVideoScript(image1Path, image2Path, image3Path, fullVideoPath, ffmpegCodec, customOptions)).then((rc) {
  211. if (rc == 0) {
  212. testGetMediaInformation(fullVideoPath);
  213. }
  214. });
  215. // COMMENT OPTIONAL TESTS
  216. // execute(VideoUtil.generateEncodeVideoScript(image1Path, image2Path, image3Path, videoPath, _currentCodec, "")).timeout(Duration(milliseconds: 1300), onTimeout: () { cancel(); });
  217. // resetStatistics();
  218. getLastReceivedStatistics().then((lastStatistics) {
  219. if (lastStatistics == null) {
  220. print('No last statistics');
  221. } else {
  222. print('Last statistics');
  223. int time = lastStatistics['time'];
  224. int size = lastStatistics['size'];
  225. double bitrate = _doublePrecision(lastStatistics['bitrate'], 2);
  226. double speed = _doublePrecision(lastStatistics['speed'], 2);
  227. int videoFrameNumber = lastStatistics['videoFrameNumber'];
  228. double videoQuality = _doublePrecision(lastStatistics['videoQuality'], 2);
  229. double videoFps = _doublePrecision(lastStatistics['videoFps'], 2);
  230. statisticsCallback(time, size, bitrate, speed, videoFrameNumber, videoQuality, videoFps);
  231. }
  232. });
  233. });
  234. });
  235. });
  236. });
  237. setState(() {});
  238. }
  239. void commandOutputLogCallback(int level, String message) {
  240. _commandOutput += message;
  241. setState(() {});
  242. }
  243. void encodeOutputLogCallback(int level, String message) {
  244. _encodeOutput += message;
  245. setState(() {});
  246. }
  247. void statisticsCallback(int time, int size, double bitrate, double speed, int videoFrameNumber, double videoQuality, double videoFps) {
  248. print("Statistics: time: $time, size: $size, bitrate: $bitrate, speed: $speed, videoFrameNumber: $videoFrameNumber, videoQuality: $videoQuality, videoFps: $videoFps");
  249. }
  250. Future<String> getFFmpegVersion() async {
  251. return await _flutterFFmpeg.getFFmpegVersion();
  252. }
  253. Future<String> getPlatform() async {
  254. return await _flutterFFmpeg.getPlatform();
  255. }
  256. Future<int> executeWithArguments(List arguments) async {
  257. return await _flutterFFmpeg.executeWithArguments(arguments);
  258. }
  259. Future<int> execute(String command) async {
  260. return await _flutterFFmpeg.execute(command);
  261. }
  262. Future<int> executeWithDelimiter(String command, String delimiter) async {
  263. return await _flutterFFmpeg.execute(command, delimiter);
  264. }
  265. Future<void> cancel() async {
  266. return await _flutterFFmpeg.cancel();
  267. }
  268. Future<void> disableRedirection() async {
  269. return await _flutterFFmpeg.disableRedirection();
  270. }
  271. Future<int> getLogLevel() async {
  272. return await _flutterFFmpeg.getLogLevel();
  273. }
  274. Future<void> setLogLevel(int logLevel) async {
  275. return await _flutterFFmpeg.setLogLevel(logLevel);
  276. }
  277. Future<void> enableLogs() async {
  278. return await _flutterFFmpeg.enableLogs();
  279. }
  280. Future<void> disableLogs() async {
  281. return await _flutterFFmpeg.disableLogs();
  282. }
  283. Future<void> enableStatistics() async {
  284. return await _flutterFFmpeg.enableStatistics();
  285. }
  286. Future<void> disableStatistics() async {
  287. return await _flutterFFmpeg.disableStatistics();
  288. }
  289. Future<Map<dynamic, dynamic>> getLastReceivedStatistics() async {
  290. return await _flutterFFmpeg.getLastReceivedStatistics();
  291. }
  292. Future<void> resetStatistics() async {
  293. return await _flutterFFmpeg.resetStatistics();
  294. }
  295. Future<void> setFontconfigConfigurationPath(String path) async {
  296. return await _flutterFFmpeg.setFontconfigConfigurationPath(path);
  297. }
  298. Future<void> setFontDirectory(String fontDirectory, Map<String, String> fontNameMap) async {
  299. return await _flutterFFmpeg.setFontDirectory(fontDirectory, fontNameMap);
  300. }
  301. Future<String> getPackageName() async {
  302. return await _flutterFFmpeg.getPackageName();
  303. }
  304. Future<List<dynamic>> getExternalLibraries() async {
  305. return await _flutterFFmpeg.getExternalLibraries();
  306. }
  307. Future<int> getLastReturnCode() async {
  308. return await _flutterFFmpeg.getLastReturnCode();
  309. }
  310. Future<String> getLastCommandOutput() async {
  311. return await _flutterFFmpeg.getLastCommandOutput();
  312. }
  313. Future<Map<dynamic, dynamic>> getMediaInformation(String path) async {
  314. return await _flutterFFmpeg.getMediaInformation(path);
  315. }
  316. void _changedCodec(String selectedCodec) {
  317. setState(() {
  318. _currentCodec = selectedCodec;
  319. });
  320. }
  321. String getFFmpegCodecName() {
  322. String ffmpegCodec = _currentCodec;
  323. // VIDEO CODEC MENU HAS BASIC NAMES, FFMPEG NEEDS LONGER LIBRARY NAMES.
  324. if (ffmpegCodec == "x264") {
  325. ffmpegCodec = "libx264";
  326. } else if (ffmpegCodec == "x265") {
  327. ffmpegCodec = "libx265";
  328. } else if (ffmpegCodec == "xvid") {
  329. ffmpegCodec = "libxvid";
  330. } else if (ffmpegCodec == "vp8") {
  331. ffmpegCodec = "libvpx";
  332. } else if (ffmpegCodec == "vp9") {
  333. ffmpegCodec = "libvpx-vp9";
  334. }
  335. return ffmpegCodec;
  336. }
  337. String getVideoPath() {
  338. String ffmpegCodec = _currentCodec;
  339. String videoPath;
  340. if ((ffmpegCodec == "vp8") || (ffmpegCodec == "vp9")) {
  341. videoPath = "video.webm";
  342. } else {
  343. // mpeg4, x264, x265, xvid
  344. videoPath = "video.mp4";
  345. }
  346. return videoPath;
  347. }
  348. String getCustomEncodingOptions() {
  349. String videoCodec = _currentCodec;
  350. if (videoCodec == "x265") {
  351. return "-crf 28 -preset fast ";
  352. } else if (videoCodec == "vp8") {
  353. return "-b:v 1M -crf 10 ";
  354. } else if (videoCodec == "vp9") {
  355. return "-b:v 2M ";
  356. } else {
  357. return "";
  358. }
  359. }
  360. List<DropdownMenuItem<String>> _getCodecDropDownMenuItems() {
  361. List<DropdownMenuItem<String>> items = new List();
  362. items.add(new DropdownMenuItem(value: "mpeg4", child: new Text("mpeg4")));
  363. items.add(new DropdownMenuItem(value: "x264", child: new Text("x264")));
  364. items.add(new DropdownMenuItem(value: "x265", child: new Text("x265")));
  365. items.add(new DropdownMenuItem(value: "xvid", child: new Text("xvid")));
  366. items.add(new DropdownMenuItem(value: "vp8", child: new Text("vp8")));
  367. items.add(new DropdownMenuItem(value: "vp9", child: new Text("vp9")));
  368. return items;
  369. }
  370. double _doublePrecision(double value, int precision) {
  371. if (value == null) {
  372. return 0;
  373. } else {
  374. return num.parse(value.toStringAsFixed(precision));
  375. }
  376. }
  377. @override
  378. Widget build(BuildContext context) {
  379. return Scaffold(
  380. appBar: AppBar(
  381. title: Text('FlutterFFmpeg Test'),
  382. centerTitle: true,
  383. ),
  384. bottomNavigationBar: Material(
  385. child: DecoratedTabBar(
  386. tabBar: TabBar(
  387. tabs: <Tab>[
  388. Tab(text: "COMMAND"),
  389. Tab(
  390. text: "VIDEO",
  391. )
  392. ],
  393. controller: _controller,
  394. labelColor: Color(0xFF1e90ff),
  395. unselectedLabelColor: Color(0xFF808080),
  396. ),
  397. decoration: BoxDecoration(
  398. border: Border(
  399. top: BorderSide(
  400. color: Color(0xFF808080),
  401. width: 1.0,
  402. ),
  403. bottom: BorderSide(
  404. width: 0.0,
  405. ),
  406. ),
  407. ),
  408. ),
  409. ),
  410. body: TabBarView(
  411. children: <Widget>[
  412. Column(
  413. crossAxisAlignment: CrossAxisAlignment.center,
  414. children: <Widget>[
  415. Container(
  416. padding: const EdgeInsets.fromLTRB(20, 40, 20, 40),
  417. child: TextField(
  418. controller: _commandController,
  419. decoration: InputDecoration(
  420. border: const OutlineInputBorder(
  421. borderSide: const BorderSide(color: Color(0xFF3498DB)),
  422. borderRadius: const BorderRadius.all(
  423. const Radius.circular(5),
  424. ),
  425. ),
  426. focusedBorder: const OutlineInputBorder(
  427. borderSide: const BorderSide(color: Color(0xFF3498DB)),
  428. borderRadius: const BorderRadius.all(
  429. const Radius.circular(5),
  430. ),
  431. ),
  432. enabledBorder: const OutlineInputBorder(
  433. borderSide: const BorderSide(color: Color(0xFF3498DB)),
  434. borderRadius: const BorderRadius.all(
  435. const Radius.circular(5),
  436. ),
  437. ),
  438. contentPadding: EdgeInsets.fromLTRB(8, 12, 8, 12),
  439. hintStyle: new TextStyle(fontSize: 14, color: Colors.grey[400]),
  440. hintText: "Enter command"),
  441. style: new TextStyle(fontSize: 14, color: Colors.black),
  442. ),
  443. ),
  444. Container(
  445. padding: const EdgeInsets.only(bottom: 20),
  446. child: new InkWell(
  447. onTap: () => testRunCommand(),
  448. child: new Container(
  449. width: 100,
  450. height: 38,
  451. decoration: new BoxDecoration(
  452. color: Color(0xFF2ECC71),
  453. borderRadius: new BorderRadius.circular(5),
  454. ),
  455. child: new Center(
  456. child: new Text(
  457. 'RUN',
  458. style: new TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold, color: Colors.white),
  459. ),
  460. ),
  461. ),
  462. ),
  463. ),
  464. Expanded(
  465. child: Container(
  466. alignment: Alignment(-1.0, -1.0),
  467. margin: EdgeInsets.all(20.0),
  468. padding: EdgeInsets.all(4.0),
  469. decoration: new BoxDecoration(borderRadius: BorderRadius.all(new Radius.circular(5)), color: Color(0xFFF1C40F)),
  470. child: SingleChildScrollView(reverse: true, child: Text(_commandOutput))),
  471. )
  472. ],
  473. ),
  474. Column(
  475. crossAxisAlignment: CrossAxisAlignment.center,
  476. children: <Widget>[
  477. Container(
  478. padding: const EdgeInsets.fromLTRB(20, 40, 20, 40),
  479. child: Container(
  480. width: 200,
  481. alignment: Alignment(0.0, 0.0),
  482. decoration: BoxDecoration(color: Color.fromRGBO(155, 89, 182, 1.0), borderRadius: BorderRadius.circular(5)),
  483. child: DropdownButtonHideUnderline(
  484. child: DropdownButton(
  485. style: new TextStyle(
  486. fontSize: 14,
  487. color: Colors.black,
  488. ),
  489. value: _currentCodec,
  490. items: _codecDropDownMenuItems,
  491. onChanged: _changedCodec,
  492. iconSize: 0,
  493. isExpanded: false,
  494. )),
  495. )),
  496. Container(
  497. padding: const EdgeInsets.only(bottom: 20),
  498. child: new InkWell(
  499. onTap: () => testEncodeVideo(),
  500. child: new Container(
  501. width: 100,
  502. height: 38,
  503. decoration: new BoxDecoration(
  504. color: Color(0xFF2ECC71),
  505. borderRadius: new BorderRadius.circular(5),
  506. ),
  507. child: new Center(
  508. child: new Text(
  509. 'ENCODE',
  510. style: new TextStyle(fontSize: 14.0, fontWeight: FontWeight.bold, color: Colors.white),
  511. ),
  512. ),
  513. ),
  514. ),
  515. ),
  516. Expanded(
  517. child: Container(
  518. alignment: Alignment(-1.0, -1.0),
  519. margin: EdgeInsets.all(20.0),
  520. padding: EdgeInsets.all(4.0),
  521. decoration: new BoxDecoration(borderRadius: BorderRadius.all(new Radius.circular(5)), color: Color(0xFFF1C40F)),
  522. child: SingleChildScrollView(reverse: true, child: Text(_encodeOutput))),
  523. )
  524. ],
  525. ),
  526. ],
  527. controller: _controller,
  528. ));
  529. }
  530. @override
  531. void dispose() {
  532. super.dispose();
  533. _commandController.dispose();
  534. }
  535. }