Skip to content

Instantly share code, notes, and snippets.

View KneePham's full-sized avatar

Knee Pham KneePham

View GitHub Profile
@KneePham
KneePham / ffmpeg_frames.sh
Created January 16, 2023 03:39 — forked from loretoparisi/ffmpeg_frames.sh
Extract all frames from a movie using ffmpeg
# Output a single frame from the video into an image file:
ffmpeg -i input.mov -ss 00:00:14.435 -vframes 1 out.png
# Output one image every second, named out1.png, out2.png, out3.png, etc.
# The %01d dictates that the ordinal number of each output image will be formatted using 1 digits.
ffmpeg -i input.mov -vf fps=1 out%d.png
# Output one image every minute, named out001.jpg, out002.jpg, out003.jpg, etc.
# The %02d dictates that the ordinal number of each output image will be formatted using 2 digits.
ffmpeg -i input.mov -vf fps=1/60 out%02d.jpg
@KneePham
KneePham / gist:a00215656eafd340f46bf7fa9dbcaaa0
Created September 4, 2018 14:58
ACF - Change file upload path for one specific field.
//https://support.advancedcustomfields.com/forums/topic/change-file-upload-path-for-one-specific-field/
add_filter('acf/upload_prefilter/name=field_name', 'field_name_upload_prefilter');
function field_nameupload_prefilter($errors) {
// in this filter we add a WP filter that alters the upload path
add_filter('upload_dir', 'field_name_upload_dir');
return $errors;
}
// second filter
function field_name_upload_dir($uploads) {
@KneePham
KneePham / gist:8a35b6f539948dac87671d69d42bba96
Created February 14, 2018 17:50
List all registered Wordpress Widgets in the footer.
add_action( 'wp_footer', function()
{
if ( empty ( $GLOBALS['wp_widget_factory'] ) )
return;
$widgets = array_keys( $GLOBALS['wp_widget_factory']->widgets );
print '<pre>$widgets = ' . esc_html( var_export( $widgets, TRUE ) ) . '</pre>';
});