[FFmpeg-user] ffmpeg whole directory file conversion question

DopeLabs dopelabs at dubstep.fm
Thu Feb 28 12:57:00 EET 2019


use the variable for the filename in the output filename

for f in *.mp4; do ffmpeg -i "$f" "$f_%03d.png"; done

cheers =]

DL



> On Feb 27, 2019, at 6:04 52PM, Ashley Smiley <ashley.smiley at berkeley.edu> wrote:
> 
> Hello,
> 
> I am writing to ask advice about how to augment my ffmpeg command line. I
> am working through my iMac's Terminal.
> 
> The task I am trying to perform is to convert a whole directory of .mp4
> files (all with unique filenames) to .png images whose labels correspond to
> their original .mp4 files.
> 
> The line I've run is:
> 
> *for i in *.mp4; *
> 
> *do ffmpeg -1 "$i" image%03d.png; *
> 
> *done*
> 
> This command line batch converts all .mp4 files to continuous .png files.
> That is, when moving from video 1 to video 2, the labeling does not start
> all over to indicate a break between video files. I would like to insert
> label breaks so that I can track which images correspond to which video and
> know exactly how many frames exist per video by conveniently having them
> labeled starting from 0 or 1 each time.
> 
> However, I don't know how to do this as I've searched online for a few days
> and I think it's time for suggestions.
> 
> An example list of filenames:
> 
> calib_checker_22sep18_154022_top_1x1cm.*mp4*
> calib_checker_22sep18_154022_side_1x1cm.*mp4*
> calib_ball_22sep18_154750_top*.mp4*
> calib_ball_22sep18_154930_side.*mp4*
> 
> and I want each to have a list of corresponding .pngs, i.e.:
> 
> calib_checker_22sep18_154022_top_1x1cm_*001.png*
> calib_checker_22sep18_154022_top_1x1cm_*002.png*
> calib_checker_22sep18_154022_top_1x1cm_*003.png*
> 
> calib_checker_22sep18_154022_side_1x1cm_*001.png*
> calib_checker_22sep18_154022_side_1x1cm_*002.png*
> 
> calib_ball_22sep18_154750_top_*001.png.*....etc.
> 
> calib_ball_22sep18_154930_side_*001.png*....etc.
> 
> One last note:
> 
> The reason I want to batch process is because there are at least 64 video
> files in the directory total.
> 
> Sincerely,
> 
> Ashley Smiley
> -- 
> Ashley Smiley
> Ph.D. Candidate, Dudley Lab
> Department of Integrative Biology
> University of California, Berkeley
> berkeleyflightlab.org
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
> 
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".



More information about the ffmpeg-user mailing list