2

I'm having trouble encoding a video for YouTube. The content isn't very "compression-friendly" (it's Battlefield 4 gameplay footage), but I'm 100% positive the results could be better. Some links:

The command I use to invoke the encoder:

ffmpeg.exe -i %INPUT%.avs -c:v libx264 -profile high -g 15 -keyint_min 15 -coder 1 ^
-preset slow -bf 2 -subq 9 -crf 18 -c:a libvorbis -pix_fmt yuv420p %OUTPUT%.mp4

I've tried many different configurations:

But none seem to make things any different. Even raw unmodified footage, recorded with ShadowPlay, looks bad: http://youtu.be/bLR-QavrpGU. Maybe I should give some other encoder a try? Or use another container? I've picked my options according to YouTube's official guide: https://support.google.com/youtube/answer/1722171

I'm all out of ideas now. Any hint would be much appreciated.

P.S. I do realize, that the frame I'm referencing is any encoder's nightmare, but why is it SO bad? And why does it affect the whole picture, not just the most hard parts of it?

EDIT: I've tried encoding with fixed bitrate (two-pass):

The album with the screenshots has been updated. 50m seems to be a little bit better than all the others (sharper edges, recognizable HUD elements, like the red tank icon on a tree to the left of the jeep; except the downscaled 1440p, of course, but it's out of the competition), but this still isn't even close to what it's supposed to be.

3 Answers 3

2

There's not much you can do. If the original file looks bad on YouTube then re-encoding it is not going to improve the situation. I'm assuming you're re-encoding your "raw unmodified footage, recorded with ShadowPlay". It's always recommended to upload the original content if possible, unless of course it is an obese file and it is impractical to upload, because YouTube is going to re-encode whatever you give it. In my opinion the HD version of your first link doesn't look terrible to me, and comparing screenshots is not exactly "fair" since the human eye does not view videos like that.

As for your command:

  • It looks decent for re-encoding: -crf being the most important factor here. You can try a slightly lower value. Some people claim to see a difference.

  • I'd personally omit -g 15 -keyint_min 15 -coder 1 -bf 2 -subq 9 because the presets will deal with most of these options and they are generally smarter than me.

  • -pix_fmt yuv420p is probably not needed for YouTube, but note that a crappy player (QuickTime, etc) may not properly decode anything other than YUV (planar) color space with 4:2:0 chroma subsampling.

  • The encoder will automatically choose a profile so there is not need for you to use -profile (which should be -profile:v since there is a -profile for some audio encoders too). This option is generally used if your decoder or device does not support more advanced profiles.

  • You can possibly stream copy the audio (-c:a copy) instead of re-encoding it, but I'm guessing your input audio was uncompressed.

  • Seeing the complete ffmpeg console output would have helped with further suggestions and prevented guesswork.

  • Not a helpful suggestion but some other site may provide better quality.

Also see:

4
  • 1
    The videos don't look to bad to me either. Not perfect, but more than acceptable. I'd definitely suggest not to do a constant bitrate encoding since it will hurt the parts where there's a lot of action. Perhaps adding a sharpening filter could help – but compared to the clip of the other guy, the "raw unmodified footage" looks really nice.
    – slhck
    Nov 25, 2013 at 6:25
  • Okay, now that I've re-watched some of the videos, they do seem to be alright in motion (though, gotta hate how all the text is becoming blurry in less than a dozen frames from each keyframe). I know that crf is preferred, but I was trying out every possible option. The excessive/redundant parameters were put in due to severe desperation, not by intent :) Some colorspace has to be set, so why not the recommended one. And you are right about the audio. In the end, I think I'll go with crf 18, no need to waste any more time on this :) Thanks for the help.
    – Alec Mev
    Nov 25, 2013 at 17:43
  • Come on, why edit, that was a fun little offtopic you had there :)
    – Alec Mev
    Jan 24, 2014 at 18:32
  • 1
    @OlegsJeremejevs It's now an "easter egg".
    – llogan
    Jan 24, 2014 at 19:19
3

The issue here is that YouTube caps the bitrate of 1080p videos to 6Mbps since the overwhelming majority of their users average sustained download speed of 5.8Mbps.

(The majority of their users are also too stupid to muck with settings, or even know what might be causing their lag, so they made the change (in the July-August time frame I believe) to fix the grumbling of the masses.)

I'd suggest a fix, but at the moment there is none. There have been multiple viable fixes in the last 3 months, but all have been removed as YouTube is adjusting it's infrastructure. Here is something you can TRY, but YMMV and YT may have disabled it already.

  1. Record at 1920x1080
  2. Encode at 2048x1152 using the lowest bitrate you can deal with for your users sake.
  3. Upload.
  4. Tell your users to play in "original" or 1440p, whatever option is available to them.

Results.

If your users leave the video in 1080p, it MIGHT be slightly more blurry for them than your previous 1080p videos. YT is down-sampling them to 2048x1152 and cutting the bitrate to 6Mbps. If they stream at full resolution, they still be down-sampling, though on their own machines, and they will be allotted a MUCH higher bitrate. The higher bitrate is both good and bad. It allows them to get a higher quality picture, but most people will have to preload half the video to prevent pausing to load. Dash playback will also limit them to 30 seconds of preloading at a time if they have not manually disabled it so they will need that off too.

1
  • Thanks for the suggestion. I had the same idea about 1440p, as it was mentioned in the edit. Here's the resulting video. IMO, it does look better, even in 1080p (though, it's a shame that ShadowPlay doesn't support any higher resolutions yet, since I play at 1600p).
    – Alec Mev
    Dec 30, 2013 at 10:13
-2
-movflags faststart B:\output.mp4

Try adding this to the final result before upload.

Keep HD framerates to 24 or 25 and quality under 4, try to match the video specifications wanted by YouTube prior to upload. NTSC is like 24000/1001. PAL is like 25.0. Possibly one must pay Youtube to upload best quality in a subscription like service.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .