new cv 2019
Just another web 3.0 blog :: prev - next

--- FFmpeg group files by encoding ---

destinationFOlder=~/desktop #list files recursively within folder, group them by specs x=`find . -type f -size +20M`;rm *.list;for i in $x;do ffprobe -hide_banner -loglevel fatal -show_error -show_format -show_streams -print_format json $i >info.txt; j=`php -r '$x=file_get_contents($argv[1]);if(!trim($x))die;$x=json_decode($x,1);if(!$x)die;$x=[$x["format"]["format_name"],$x["streams"][0]["codec_name"],$x["streams"][0]["width"],$x["streams"][0]["height"],$x["streams"][0]["r_frame_rate"]];echo preg_replace("~[^a-z0-9.-_]+~i","",implode("-",$x));' info.txt`; ');" onmouseout="HT()">$i);$ef=end($ef);if(substr($ef,0,2)!="dd"){$i2=str_replace($ef,"dd".date("Ymd-His",filemtime($i))."-drn-".preg_replace("~[^a-z0-9.-_]+~i","",$ef),$i);rename($i,$i2);die($i2);}die($i);' $i $j`; echo ">$i>$j";echo "file '$i'" >> $j.list; done; #-- then foreach list concat those files x=`find . -name *.list`; for list in $x; do php -r '$list=$argv[1];$x=explode(" ",file_get_contents($list));asort($x);file_put_contents($list,trim(implode(" ",$x)));' $list reOrdersList;ffmpeg -y -f concat -hide_banner -loglevel error -safe 0 -i $list -c copy -acodec copy $destinationFOlder$list.mp4;done; #final cleanup assemby files php -r '$x=explode(" ",file_get_contents($argv[1]));foreach($x as $v){$v=trim(str_replace(["file ","./"],"",$v),chr(39));unlink($v);echo" del:".$v;}' movmp4m4a3gp3g2mj2-h264-4096-2160-240001001.list cleanupFilesUsedToBeConcatOnceOk

Developpeur php Geneve - php - rando - trip - india - web - php - dev - eco - science - astro - shop - annecy - ffmpeg