0

I've been trying to encode a collection of videos I have to remove unnecessary logos from the beginning & reduce file size. I'm using FFmpeg to start at approximately 6.2 seconds or 186 frames after the start of the video. Once completed, I was seeing horizontal lines that seemed indicitive of interlacing, so I tried adding -vf yadif to my bash script. Here is my script for encoding:

if [[ $PWD = *"show_name"* ]]; then
    for i in {1..7}; 
        do ffmpeg -ss 6.2 -i "./show name - s2e$i.mkv" -c:v libx264 -preset slow -crf 16 -vf yadif -c:a copy "/blah/blah/show name - s2e$i.mkv";
    done
fi

When the script is completed, I'm left with video that looks barely okay considering it's supposed to be "visually lossless." Here are some visual examples.

Image Comparision

The top image is the original media. The bottom image is the new, encoded media. Notice the high level of erroneous pixels around what were lightly shaded areas. Is this the result of the interlacing filter? How do I improve image quality? All I'm trying to really do is remove a few seconds from the beginning of the clip.

Originally, when I used -c copy for my ffmpeg settings, it would copy the media directly, which seemed to cause players to skip the first tens of frames in the media since, I assume, it had no key frame to continue off of (?). Here is the MediaInfo video information about the original video file.

How can I remove the first 6.2 seconds or 186 frames of each clip while keeping the original quality of the video file?

  • 1
    Did you try putting the -ss parameter after the -i one when using the -c copy approach? Try: ffmpeg -i "./show name - s2e$i.mkv" -ss 00:00:06.2 -c copy "/blah/blah/show name - s2e$i.mkv" in your script. Also see slhck's excellent ffmpeg document. Look for 'Cutting Video'. Also related: Using ffmpeg to cut up video – mcalex Aug 1 '18 at 4:06
  • @mcalex Your tip appeared to help but it also looks like the new video files I'm trying to encode are actually interlaced and ffmpeg is trying to convert them to progressive when encoding, which ruins the quality. Any idea there? – dylanweber Aug 1 '18 at 4:39
  • 1
    Additionally, enabling the detelecine filter in Handbrake appeared to fix the issue entirely... Perhaps I was using the wrong filter. – dylanweber Aug 1 '18 at 4:58
  • Cool. I was going to suggest dropping the crf even further (yah - beyond the sane) or maybe check with the Video Production experts – mcalex Aug 1 '18 at 5:05
  • 1
    Looks like you've solved it, but those are interlacing artifacts, not related to CRF value. – Gyan Aug 1 '18 at 6:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.