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.



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 -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%


  • 0

    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

    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

    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...



  • 0
  • 0
    Bright Scripters

    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
    Tobias Becker

    to add to this since it took me quit a while to figure it out:
    using XT1143 7.0.60, Brighauthor,  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:
    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:
    (710 mb)

    (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

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

  • 0

    @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

    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"




  • 0
    Ken Campbell

    Since this is a sticky…

    H265 decoding on Series 3 and Series 4 XD and XT models can easily handle bitrates above 20 Mbps, CBR or VBR. I’ll often start my bitrate targets around 50 Mbps and fine tune average and max bitrates from there, depending on the nature and requirements of the content.

    H264 not so much. 25 Mbps vbv-max if I’m feeling lucky with a 20 Mbps average target when VBR. But to be fair I found most commercial grade media players topped out around there with H264.

    I’ll have to try some comparative tests using different GOP & IDR settings.


  • 0
    James Brown

    @Tobias Becker

    How did you generate the sample files you posted with audio?

    I've tried numerous commands with ffmpeg and I can't generate a file that will loop seamlessly. Your files work. If I swap out either the audio or the video in your file, it fails. As far as I can see using ffmpeg, my file and your file are encoded the same (same codec, bit rates, etc.).

    What's the magic?!

  • 0

    Seamless looping makes the file data loop back onto itself, so all tracks in the file must be exactly the same duration by total sample size and number.  Seamless looping of a video requires that all tracks are exactly the same duration down to the sample - not just the duration in the metadata, and MP4 or MOV container.
    See this article for more information:

Please sign in to leave a comment.