Index: trunk/extensions/MetavidWiki/maintenance/transcode_to_flv.php |
— | — | @@ -25,6 +25,29 @@ |
26 | 26 | //mencoder based (good) |
27 | 27 | $flvEncodeCommand = 'mencoder $input -noskip -mc 0 -o $output -of lavf -oac mp3lame -lameopts abr:br=32 -ovc lavc -lavcopts vcodec=flv:vbitrate=250:mbd=2:mv0:trell:v4mv:cbp:last_pred=3 -vf scale=400:300 -srate 22050 -lavfopts i_certify_that_my_video_stream_does_not_use_b_frames'; |
28 | 28 | |
| 29 | +if ( count( $args ) == 0 || isset ( $options['help'] ) ) { |
| 30 | + print<<<EOT |
| 31 | +Run transcode for HQ oggs |
| 32 | +from dir: $mvMountedSource *.HQ.ogg |
| 33 | +to dir: $mvMountedDest *.flv |
| 34 | + |
| 35 | +default: |
| 36 | + only gennerates flvs where the ogg exists and a flv is missing |
| 37 | + |
| 38 | +arguments: |
| 39 | + generate_new_flv // used if you do a new set flv encode (will remove old flv in place) |
| 40 | + |
| 41 | + |
| 42 | +EOT; |
| 43 | + exit (); |
| 44 | +} |
| 45 | +$genNewFlv = false; |
| 46 | +switch ( $args[0] ) { |
| 47 | + case 'generate_new_flv' : |
| 48 | + $genNewFlv = true; |
| 49 | + break; |
| 50 | +} |
| 51 | + |
29 | 52 | $doneWithTrascode=false; |
30 | 53 | while($doneWithTrascode==false){ |
31 | 54 | $doneWithTrascode=true; |
— | — | @@ -47,7 +70,11 @@ |
48 | 71 | if(substr($source_file, -7)=='.HQ.ogg'){ |
49 | 72 | //gennerate flash file name: |
50 | 73 | $stream_name = substr( $source_file,0,(strlen($source_file)-7)); |
51 | | - $local_fl =$mvMountedDest . $stream_name . '.new.flv'; |
| 74 | + if($genNewFlv){ |
| 75 | + $local_fl =$mvMountedDest . $stream_name . '.new.flv'; |
| 76 | + }else{ |
| 77 | + $local_fl =$mvMountedDest . $stream_name . '.flv'; |
| 78 | + } |
52 | 79 | clearstatcache(); |
53 | 80 | if(!is_file($local_fl)){ |
54 | 81 | $doneWithTrascode=false; |
— | — | @@ -85,20 +112,20 @@ |
86 | 113 | //update db: |
87 | 114 | update_flv_pointer_db($stream_name); |
88 | 115 | //remove the old local_file: |
89 | | - unlink($mvMountedDest . $stream_name . '.flv'); |
90 | | - unlink($mvMountedDest . $stream_name . '.flv'.META_DATA_EXT); |
91 | | - //move file to "live" location |
92 | | - rename($local_fl, $mvMountedDest . $stream_name . '.flv'); |
93 | | - rename($local_fl.META_DATA_EXT, $mvMountedDest . $stream_name . '.flv'.META_DATA_EXT); |
94 | | - //keep an empty file in place of .new (so we don't re-do this same stream) |
95 | | - file_put_contents($local_fl, ' -async 2 done '); |
96 | | - file_put_contents($local_fl.META_DATA_EXT, ' -async 2 meta done '); |
97 | | - //print "put zeor size file_contents"; |
98 | | - |
| 116 | + if($genNewFlv){ |
| 117 | + unlink($mvMountedDest . $stream_name . '.flv'); |
| 118 | + unlink($mvMountedDest . $stream_name . '.flv'.META_DATA_EXT); |
| 119 | + //move file to "live" location |
| 120 | + rename($local_fl, $mvMountedDest . $stream_name . '.flv'); |
| 121 | + rename($local_fl.META_DATA_EXT, $mvMountedDest . $stream_name . '.flv'.META_DATA_EXT); |
| 122 | + //keep an empty file in place of .new (so we don't re-do this same stream) |
| 123 | + file_put_contents($local_fl, ' -async 2 done '); |
| 124 | + file_put_contents($local_fl.META_DATA_EXT, ' -async 2 meta done '); |
| 125 | + } // |
99 | 126 | break; //break out of forloop |
100 | 127 | } |
101 | 128 | }else{ |
102 | | - print "skiped HQ_File: {$mvMountedSource}{$source_file} \n"; |
| 129 | + print "skipped HQ_File: {$source_file} (local .flv file already exists) \n"; |
103 | 130 | } |
104 | 131 | } |
105 | 132 | } |
Index: trunk/extensions/MetavidWiki/maintenance/mv_oneTime_fixes.php |
— | — | @@ -17,6 +17,7 @@ |
18 | 18 | strip_speech_by //strips extra speech by text |
19 | 19 | update_stream_desc //updates stream desc |
20 | 20 | update_archive_org_files [stream_name] //updates pointers to archive.org mp4 streaming |
| 21 | + update_flv_meta //gennerates meta data for all .flv files in /metavid/video_archive |
21 | 22 | |
22 | 23 | EOT; |
23 | 24 | exit (); |
— | — | @@ -33,6 +34,9 @@ |
34 | 35 | case 'update_stream_desc': |
35 | 36 | update_stream_desc(); |
36 | 37 | break; |
| 38 | + case 'update_flv_meta': |
| 39 | + update_flv_meta(); |
| 40 | + break; |
37 | 41 | case 'update_archive_org_files': |
38 | 42 | $stream_name = (isset( $args[1] ))?$args[1]:''; |
39 | 43 | run_archive_org_update( $stream_name ); |
— | — | @@ -73,7 +77,29 @@ |
74 | 78 | } |
75 | 79 | } |
76 | 80 | } |
77 | | - |
| 81 | +function update_flv_meta(){ |
| 82 | + $path = '/metavid/video_archive/'; |
| 83 | + $flist = scandir($path); |
| 84 | + require_once('../skins/mv_embed/flvServer/MvFlv.php'); |
| 85 | + foreach($flist as $local_fl){ |
| 86 | + print "lf: is_file(" . $path . $local_fl . ")\n"; |
| 87 | + if( is_file($path.$local_fl) && substr($local_fl, -3)=='flv'){ |
| 88 | + //check for .meta |
| 89 | + |
| 90 | + if(!is_file($path . $local_fl .'.meta')){ |
| 91 | + echo "generating flv metadata for {$path}{$local_fl} \n"; |
| 92 | + $flv = new MyFLV(); |
| 93 | + try { |
| 94 | + $flv->open( $path . $local_fl ); |
| 95 | + } catch (Exception $e) { |
| 96 | + die("<pre>The following exception was detected while trying to open a FLV file:\n" . $e->getMessage() . "</pre>"); |
| 97 | + } |
| 98 | + $flv->getMetaData(); |
| 99 | + echo "done with .meta (" . filesize($path.$local_fl.META_DATA_EXT).") \n"; |
| 100 | + } |
| 101 | + } |
| 102 | + } |
| 103 | +} |
78 | 104 | function update_stream_desc(){ |
79 | 105 | /*==Official Record== |
80 | 106 | *[[GovTrack]] Congressional Record[http://www.govtrack.us/congress/recordindex.xpd?date=20080609&where=h] |