-1

H.265 FFMPEG PCM Audio

 

I've seen a few questions about encoding h.265 with ffmpeg or with pcm audio. Here are directions posted by a colleague for generating a seamless 60fps file. I've also included some other ffmpeg output strings we've sent customers for generating h.265 files.

 

This is a seamlessly looping h.265 file with pcm audio.

 

FFMPEG

F:\vboxshared\Zeranoe\ffmpeg -probesize 500M -analyzeduration 500M -loglevel verbose -i F:\EncodeSource\50194\CLIP_TT.mov -pix_fmt yuv420p -s:v:0 1920x1080 -preset:v medium -c:v libx265 -x265-params vbv-bufsize=10000:vbv-maxrate=40000:crf=16:bframes=2 -c:a pcm_s16le -ar 48000 F:\EncodeSource\50194\CLIP_TT_H265_Seamless_Loop.mov

 

FFMPEG Other:

 

ffmpeg -i inputfile.mov -c:v libx265 -preset:v ultrafast -x265-params crf=20 -pix_fmt yuv420p outfile.ts

ffmpeg -i inputfile.mov -c:v libx265 -x265-params bitrate=15000:vbv-bufsize=8000:vbv-maxrate=15000 -pix_fmt yuv420p outfile.ts

 

ffmpeg -i %INPUTFILE% -c:v libx265 -x265-params bitrate=27000:vbv-bufsize=8000:vbv-maxrate=40000 -pix_fmt yuv420p -movflags +faststart -f mp4 %OUTPUTFILE%

9 comments

  • 0
    Avatar
    marcel

    so it means in case of the HD223 you have to go down to 15Mbps with the bitrate

    to reach no hiccups with the H265 Codec?

     

     

     

  • 0
    Avatar
    Lyndon

    I'm not sure who you got that from these examples. I was not saying you had to use 15Mbps or that this was some cap.  Hiccups can be caused bit bitrate spikes well above the average. I seem files encoded at 20 or 30 or 40 bps, but when you run them through analyzer they have spikes over 200Mbps at various points. 

     

    If you have a specific video with hiccups, send us a link and we can check it out. 

  • 0
    Avatar
    marcel

    i got that assumption out of your example compilation commands (bitrate=15000)

    as the hd223 can not handle more then 25mbps.

    i'll test out some more options and let you know...

     

    thanks!

  • 0
    Avatar
    Romeo
  • 0
    Avatar
    Bright Scripters info[at]brightscripters.com

    Great post Romeo!

    Since FW 6.2+ the XT3, XD3 and 4K players, have a media analysis tool built-in that calculates an ABR over 1 second time period.

    That sounds like a great feature!

  • 0
    Avatar
    Tobias Becker

    to add to this since it took me quit a while to figure it out:
    using XT1143 7.0.60, Brighauthor 4.7.0.20,  ffmpeg nightly build (ffmpeg-20180619-a990184) on windows 10

    Use the option "Loop media if no media transition is specified" (screenshot) then it works seamless (3840x2160p/50 and p/60 + PCM).
    Do NOT use the "Media End Event" from interactive playlists since this behaves different and will cause the loop (audio and video) to stutter for ~ .5s.

    Some info that helped me to make this work:

    Install ffmpeg to command line:
    http://adaptivesamples.com/how-to-install-ffmpeg-on-windows/
    Use PowerShell instead of command line - its visually much easier to use (at least in Win 10).

    Used parameters that work as seamless loop in 2160p/50 and p/60 with audio (see commend above about Media End Event):
    ffmpeg  -probesize 500M -analyzeduration 500M -loglevel verbose -i C:\Users\Show\Desktop\encoding\testp\seamless-loop-50p-uhd1-1k.mov  -pix_fmt yuv420p -s:v:0 3840x2160 -preset:v medium -c:v libx265 -x265-params vbv-bufsize=10000:vbv-maxrate=40000:crf=16:bframes=2 -c:a pcm_s16le -ar 48000 C:\Users\Show\Desktop\encoding\export\ffmpeg-h265-pcm-uhd150p-test.mov

    // Update: I had good success with this parameters which effectively spread the uneven bitrate more evenly in a sense (see the Bitrate Analysis in the Brightsign unit). Have not done 1:1 quality comparison but that depends on the content as well of course.
    Source: https://brightsign.zendesk.com/hc/en-us/articles/360003401794-Some-video-encoding-advice-on-video-bitrate%C2%A0   removed -an and added PCM audio:
    ffmpeg -probesize 500M -analyzeduration 500M -loglevel verbose -i C:\Users\Show\Desktop\encoding\testp\seamless-loop-50p-uhd1-1k.mov -pix_fmt yuv420p -s:v:0 3840x2160 -preset:v medium -c:v libx265 -x265-params bitrate=35000:vbv-maxrate=35000:vbv-bufsize=9000:bframes=2:open-gop=0:keyint=60 -c:a pcm_s16le -ar 48000  C:\Users\Show\Desktop\encoding\export\test-forum-pcm2.mp4


    Files for testing 50 or 60 seamless with 1k audio:
    http://f.becker.tv/encoding/seamless-loop-50p-uhd1-1k.mov
    (710 mb)

    http://f.becker.tv/encoding/seamless-loop-60p-uhd1-1k.mov
    (850 mb)

    Crucher (Win only):
    https://getcruncher.com/ has build in H.265/HEVC support and added PCM support recently.
    Unfortunately currently the PCM support is not working with the above test files (failing at about 15% or rendering AAC audio track).
    They have an email with details.

    If you find other Encoding Software that allows H.265 2160p50 + PCM feel free to comment!

  • 0
    Avatar
    Roman

    Any seamless loops with 10bit? And by that I mean the main10 profile and pix_fmt yuv420p10le. 

  • 0
    Avatar
    Roman

    @Tobias I just encoded a 1 hour long video with you settings and it is far away from being seamless. 

    ffmpeg.exe -probesize 500M -analyzeduration 500M -i input.mxf -pix_fmt yuv420p -s:v:0 3840x2160 -preset:v medium -c:v libx265 -x265-params bitrate=35000:vbv-maxrate=35000:vbv-bufsize=9000:bframes=2:open-gop=0:keyint=60 -c:a pcm_s16le -ar 48000 output.mov

    Also the i-frame bitrate is pretty extreme:

     

  • 0
    Avatar
    semi

    Extras tips if your having trouble with video/audio bitrate drop outs.

    Always do 20cbr in H264 and H265. Anything too busy or even slow fade ins from black, anything higher than 20cbr, drops out on all media players Ive tried from hd220 to xd233.

    The problem is that it never really encoded constant bitrate and the Brightsigns cannot really handle what they claim. For anything synchronized it must not drop any frames.

    The audio isnt the issue but PCM is best sound quality

    I use Abode AME to make my H264/5 files with aac audio and then use FFMPEG to swap a seperate wav file into them.

    ffmpeg -i "path.mp4" -i "path.wav" -vcodec copy -acodec copy -map 0:v:0 -map 1:a:0 "path.mov"

     

     

     

Please sign in to leave a comment.