VideoHelp Forum
+ Reply to Thread
Page 2 of 2
FirstFirst 1 2
Results 31 to 39 of 39
Thread
  1. I want to crop the material now. I checked with ffplay and this works:


    ffmpeg -i WESTERBORK_2019_Resto(with_dupes_without_pretitles ).mp4 -filter:v "crop=693:520:134:10" -c:a copy Westerbork_cropped.mp4


    how can I combine ths command with the framecount burn in?

    ffmpeg -i Westerbork_cropped.mp4 -vf decimate=cycle=3,drawtext=fontfile=Arial.ttf:fonts ize=25:fontcolor=white:text=''%{frame_num}:borderc olor=black:borderw=2=20:y=20 Westerbork_cropped_framerate.mp4
    Quote Quote  
  2. Add the crop and a comma between the -vf and decimate:

    Code:
    -vf crop=693:520:134:10,decimate=cycle=3,drawtext...
    Quote Quote  
  3. Originally Posted by jagabo View Post
    Add the crop and a comma between the -vf and decimate:

    Code:
    -vf crop=693:520:134:10,decimate=cycle=3,drawtext...
    Thanks!

    And one more question about the framecount. I have another case, where I want to burn in a framecount with certain delay. There's a pretitle that shouldn't count, but doesn't have to be removed. Can I substract the exceeding number of frames?

    ffmpeg -i Westerbork_cropped.mp4 -vf drawtext=fontfile=Arial.ttf:fontsize=25:fontcolor= white:text=''%{frame_num-120}:bordercolor=black:borderw=2=20:y=20 Westerbork_cropped_framerate.mp4
    Quote Quote  
  4. You'd think that would work but it doesn't. You can use "text='%{frame_num}': start_number=120" to start with frame number 120 instead of 0. But it doesn't accept a negative number. I don't have a solution for you.
    Quote Quote  
  5. Here's a way you can brute force it with a batch file. Basically, encode the first part without frame numbers, the second part with frame numbers, concatenate the two intermediate files to a third, remux to mp4, then delete the intermediate files:

    Code:
    ffmpeg -y -i input.mp4 -to 00:00:04.8  part1.ts
    ffmpeg -y -ss 00:00:04.8 -i input.mp4 -vf drawtext=fontfile=C\\:/Windows/fonts/arial.ttf:fontcolor=white:text='%%{frame_num}':bordercolor=black:borderw=2:x=20:y=20 part2.ts
    copy/b part1.ts+part2.ts all.ts
    ffmpeg -y -i all.ts -c copy output.mp4
    del part1.ts
    del part2.ts
    del all.ts
    Quote Quote  
  6. you can use filter_complex graph

    split the input - one with intro [a] , one with main [b] , and -vf trim the clips to desired range, where -vf drawtext framenumbering is applied to [b], then -vf concat for the output node

    https://ffmpeg.org/ffmpeg-filters.html#trim

    (note the end_frame arg is exclusive, not inclusive in ffmpeg -vf trim)

    https://ffmpeg.org/ffmpeg-filters.html#toc-concat

    ffmpeg is a bit tricky, in that everything runs on timestamps, so whenever you trim you need to insert a setpts filter


    In this 600 frame, 25fps example, 0-99 (inclusive) is the intro , 100-599 (inclusive) is the main part that has drawtext applied (frame 100 would start with "zero")

    Code:
    ffmpeg -i input.mp4 -filter_complex "split[a][b]; [a]trim=start_frame=0:end_frame=100,setpts=N/(25*TB)[a2]; [b]trim=start_frame=100:end_frame=600,setpts=N/(25*TB), drawtext=fontfile='C\:\\Windows\\Fonts\\Arial.ttf':fontsize=25:fontcolor= white:text=''%{frame_num}:black:borderw=2:x=20:y=20[b2]; [a2][b2]concat[out]" -map [out] -c:v libx264 -crf 20 -an output.mp4
    Quote Quote  
  7. Originally Posted by poisondeathray View Post
    Code:
    ffmpeg -i input.mp4 -filter_complex "split[a][b]; [a]trim=start_frame=0:end_frame=100,setpts=N/(25*TB)[a2]; [b]trim=start_frame=100:end_frame=600,setpts=N/(25*TB), drawtext=fontfile='C\:\\Windows\\Fonts\\Arial.ttf':fontsize=25:fontcolor= white:text=''%{frame_num}:black:borderw=2:x=20:y=20[b2]; [a2][b2]concat[out]" -map [out] -c:v libx264 -crf 20 -an output.mp4
    Nice. I thought it could be done but didn't know enough about filter_complex to piece it together.
    Quote Quote  
  8. a cool! Actually I don't need the intro anyway. I guess it would it be much easier to simply cut off the intro and then burn the framerate into th rest?
    Quote Quote  
  9. Originally Posted by Fabian Schmidt View Post
    a cool! Actually I don't need the intro anyway. I guess it would it be much easier to simply cut off the intro and then burn the framerate into th rest?
    Yes. One line of my "brute force" batch file does exactly that, by time, not frame number. 120 frames at 25 fps is 4.8 seconds (120 / 25):

    Code:
    ffmpeg -ss 00:00:04.8 -i input.mp4 -vf drawtext=fontfile=C\\:/Windows/fonts/arial.ttf:fontcolor=white:text='%%{frame_num}':bordercolor=black:borderw=2:x=20:y=20 output.mp4
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!