Encoding video into DNxHD for editing.

Get answers to your questions about color grading, editing and finishing with DaVinci Resolve.
  • Author
  • Message
Offline

Igor Vinograd

  • Posts: 19
  • Joined: Mon Jan 02, 2017 9:21 pm

Encoding video into DNxHD for editing.

PostSun Mar 12, 2017 8:55 pm

I'm trying to work with some 1600x900 25fps H.264 video. The video edits great but when delivering 1920x1080 59.94fps H.264 video the encoding is ultra slow.

Code: Select all
if not exist newfilescap md newfilescap
for %%A in (*.MP4) do ffmpeg -i "%%A" -r 60000/1001 -s 1920x1080 -vcodec libx264 -acodec pcm_s16le -ar 48000 -ac 2 "newfilescap\%%~nA.mov"
pause


Using the above script and FFMPEG I re encoded the video into something that is closer to the delivery format to speed up delivery. The problem now is that when editing the video, after a few changes it will show "Media Offline".

After doing some more reading the best format for Resolve is DNxHD. I'm trying to balance editing ease and delivery encoding speed. I'm having difficulty locating or constructing a command for FFMPEG to give usable video if any video at all.

What FFMPEG command do i need to get best DNxHD results for Resolve or what is the best way to re encode the video?
Offline

Paul Sangha

  • Posts: 123
  • Joined: Wed May 27, 2015 3:58 pm

Re: Encoding video into DNxHD for editing.

PostMon Mar 13, 2017 3:55 pm

Igor - if you search through the manual/google/youtube for 'Davinci Resolve Optimized Media' - you can create DNx based temp/proxy files (you choose what format/resolution from settings) from within resolve to work with; and turn it off when in deliver page.
| www.Paulharveer.com | Engineer/Photographer |
Offline

Mads Johansen

  • Posts: 1407
  • Joined: Mon Dec 19, 2016 10:51 am

Re: Encoding video into DNxHD for editing.

PostMon Mar 13, 2017 9:46 pm

Igor Vinograd wrote:I'm trying to work with some 1600x900 25fps H.264 video. The video edits great but when delivering 1920x1080 59.94fps H.264 video the encoding is ultra slow.

Code: Select all
if not exist newfilescap md newfilescap
for %%A in (*.MP4) do ffmpeg -i "%%A" -r 60000/1001 -s 1920x1080 -vcodec libx264 -acodec pcm_s16le -ar 48000 -ac 2 "newfilescap\%%~nA.mov"
pause


That command converts your source footage to h264, which is a highly compressed format and Resolve does not like that.
I think you might have missed my reply to your previous thread (viewtopic.php?f=21&t=56675#p324966 ), as you don't specify compression settings to libx264.


Igor Vinograd wrote:Using the above script and FFMPEG I re encoded the video into something that is closer to the delivery format to speed up delivery. The problem now is that when editing the video, after a few changes it will show "Media Offline".

After doing some more reading the best format for Resolve is DNxHD. I'm trying to balance editing ease and delivery encoding speed. I'm having difficulty locating or constructing a command for FFMPEG to give usable video if any video at all.

What FFMPEG command do i need to get best DNxHD results for Resolve or what is the best way to re encode the video?


I don't think you have completely understood your dilemma:
The best way to explain is to use Porters Value Chain: You start with Input, then do some Processing, then Output (and a bunch more irrelevant theory). The tree parts are separate problems with their own challenges:

The Input problem is where you select what would be best for editing, in this case you use dnxhd (or mpeg4 or ...). To solve this problem I would convert to mpeg (as explained earlier), then do the edits.

The Processing problem is the actual editing, something a little connected to input (in this case with h264 making editing slow) as a highly compressed format will require more CPU power to uncompress into something Resolve can work with. Choosing a lightly compressed codec will help here.

The Output speed is 90 to 95% dependent on the codec you select. Choosing h.264 will make the
delivery slower than mpeg4 (although per this forum not recommended to output in either format. The best course of action would be to output to dnxhd/dnxhr 444 / grass valley HQX, then do the actual compression with ffmpeg.)

Depending on your space/time constraints slow, slower or placebo would be the best preset to use. (Please have in mind that placebo is extremely slow, in the order of 2 fps)
Code: Select all
for %%a in ("*.mov") do timer ffmpeg -i "%%a" -c:v libx264 -preset PRESET_NAME_HERE -c:a aac -ac 2 -b:a 320k "%%~na-placebo.mp4"


Resolve also have a transcode function: See chapter 21 in the manual
Davinci Resolve Studio 20 build 49, Windows 11, Ultra 7 265k, Nvidia 5070 TI, 576.80 Studio
Offline

Igor Vinograd

  • Posts: 19
  • Joined: Mon Jan 02, 2017 9:21 pm

Re: Encoding video into DNxHD for editing.

PostTue Mar 14, 2017 10:58 pm

Pretty much any thing re encoded in h264 causes Resolve to freak out and show media offline either right away or after some editing.

I had the best results converting to mpeg4 with the following line. It didn't crash and delivers at almost real time.

Code: Select all
if not exist newfiles md newfiles
for %%A in (*.MTS) do ffmpeg -i "%%A" -r 60000/1001 -s 1920x1080 -vcodec mpeg4 -q:v 1 -c:a aac -ac 2 -b:a 320k -ar 48000 "newfiles\%%~nA.mov"
pause


Thanks for the help.
Offline

Andrew Kolakowski

  • Posts: 9530
  • Joined: Tue Sep 11, 2012 10:20 am
  • Location: Poland

Re: Encoding video into DNxHD for editing.

PostTue Mar 14, 2017 11:34 pm

When you converting from 4:2:2 (or 4:4:4) files by the default you end up with 4:2:2 (4:4:4) h264 MP4/MOV files which are unsupported by Resolve. Just add -pix_fmt yuv420p into your command.
Offline
User avatar

Cary Knoop

  • Posts: 1654
  • Joined: Sun Mar 12, 2017 6:35 pm
  • Location: Newark, CA USA

Re: Encoding video into DNxHD for editing.

PostTue Mar 14, 2017 11:38 pm

Andrew Kolakowski wrote:When you converting from 4:2:2 files you end up with 4:2:2 h264 MP4/MOV files which re unsupported by Resolve. Just add -pix_fmt yuv420p into your command.

I was not aware DaVinci did not support H.264 4:2:2!

That's going to be an unpleasant surprise for the new Panasonic GH5 enthusiasts.

Andrew how do you like the -c:v prores_ks option on Windows?
Offline

Igor Vinograd

  • Posts: 19
  • Joined: Mon Jan 02, 2017 9:21 pm

Re: Encoding video into DNxHD for editing.

PostTue Mar 14, 2017 11:58 pm

Andrew Kolakowski wrote:When you converting from 4:2:2 (or 4:4:4) files by the default you end up with 4:2:2 (4:4:4) h264 MP4/MOV files which are unsupported by Resolve. Just add -pix_fmt yuv420p into your command.


This line had similar effect with "media offline" even with -pix_fmt yuv420p. I tried slow, slower and placebo for PRESET_NAME.


Code: Select all
if not exist newfiles md newfiles
for %%A in (*.mp4) do ffmpeg -i "%%A" -r 60000/1001 -s 1920x1080 -vcodec libx264 -preset  PRESET_NAME -pix_fmt yuv420p -c:a aac -ac 2 -b:a 320k -ar 48000 "newfiles\%%~nA.mov"
pause
Offline

Andrew Kolakowski

  • Posts: 9530
  • Joined: Tue Sep 11, 2012 10:20 am
  • Location: Poland

Re: Encoding video into DNxHD for editing.

PostWed Mar 15, 2017 12:02 am

Hmmm...something is not right then.
Post small sample of such a file. It maybe something with your system.

Is it fairly recent ffmepg and Resolve? I assume you are on PC?
Try doing -c:a pcm_s24le for audio.

vcodec is now replaced with -c:v. Your method is legacy. Use new commands.

Also try -r 30000/1001 (even if this is not what you want)- maybe Resolve on Windows supports only up to 4.1 level (59.94p will be 4.2)

Why are you converting file into h264+ AAC for use in Resolve? This is very bad idea. Use DNxHR or ProRes with PCM.
Last edited by Andrew Kolakowski on Wed Mar 15, 2017 12:23 am, edited 2 times in total.
Offline

Andrew Kolakowski

  • Posts: 9530
  • Joined: Tue Sep 11, 2012 10:20 am
  • Location: Poland

Re: Encoding video into DNxHD for editing.

PostWed Mar 15, 2017 12:08 am

Cary Knoop wrote:
Andrew Kolakowski wrote:When you converting from 4:2:2 files you end up with 4:2:2 h264 MP4/MOV files which re unsupported by Resolve. Just add -pix_fmt yuv420p into your command.

I was not aware DaVinci did not support H.264 4:2:2!

That's going to be an unpleasant surprise for the new Panasonic GH5 enthusiasts.

Andrew how do you like the -c:v prores_ks option on Windows?


BM just aded support for GH5 files but only in Studio version of Resolve ( I assume decoding is moved into Mainconcept licensed AVC decoder, which can support all AVC modes (10bit, 4:2:2, etc)).
Prores_ks is slow (no multithreading implemented), but it supports proper interlaced mode, 444 and alpha. It also restricts bitrate closely to Apple official modes.
Offline

Igor Vinograd

  • Posts: 19
  • Joined: Mon Jan 02, 2017 9:21 pm

Re: Encoding video into DNxHD for editing.

PostWed Mar 15, 2017 1:02 am

Code: Select all
if not exist newfiles md newfiles
for %%A in (*.mp4) do ffmpeg -i "%%A" -r 60000/1001 -s 1920x1080 -c:v libx264 -preset  slow -pix_fmt yuv420p -c:a pcm_s24le -ac 2 -b:a 320k -ar 48000 "newfiles\%%~nA.mov"
pause


The preceding command also eventually gives a "media offline" error while editing.

My machine is a laptop with Core i7 3740QM 2.7GHz processor, 16GB or ram, AMD Radeon HD 7570M and Windows 7 64bit. I'm using ffmpeg downloaded about a month ago. I'm using Resolve 12.5.4.

Andrew Kolakowski wrote:Why are you converting file into h264+ AAC for use in Resolve? This is very bad idea. Use DNxHR or ProRes with PCM.


My original post ask for the best command that would convert to DNxHR using ffmpeg or some other conversion process.
Offline
User avatar

Cary Knoop

  • Posts: 1654
  • Joined: Sun Mar 12, 2017 6:35 pm
  • Location: Newark, CA USA

Re: Encoding video into DNxHD for editing.

PostWed Mar 15, 2017 4:14 am

Andrew Kolakowski wrote:BM just aded support for GH5 files but only in Studio version of Resolve ( I assume decoding is moved into Mainconcept licensed AVC decoder, which can support all AVC modes (10bit, 4:2:2, etc)).

Andrew, I just tried some 4:2:2 10 bit GH5 test footage with the free version of Resolve and it seems to work fine.

Andrew Kolakowski wrote:Prores_ks is slow (no multithreading implemented), but it supports proper interlaced mode, 444 and alpha. It also restricts bitrate closely to Apple official modes.

Since prores is intra only and assuming the seek of the source file is reliable would you see any issues with segmenting a video and execute ffmpeg in parallel?
Offline

Andrew Kolakowski

  • Posts: 9530
  • Joined: Tue Sep 11, 2012 10:20 am
  • Location: Poland

Re: Encoding video into DNxHD for editing.

PostWed Mar 15, 2017 10:07 am

Was it 50/60p UHD sample? These are 4:2:0.

No, you can segment and run many instances, but be careful not to miss some frames (specially for 23.976/29.97 etc).
Last time I tried it I had issues due to the way how ffmpeg works (rounded time stamps).
Best is to work with seeking after -i (then you can work in frames), but then you waste time as file has to be decoded up to your in point for each part.
Using -ss before -i is fast but as I said you have to watch not to miss frame (at worse it's just 1 frame).
Last edited by Andrew Kolakowski on Wed Mar 15, 2017 10:17 am, edited 1 time in total.
Offline

Andrew Kolakowski

  • Posts: 9530
  • Joined: Tue Sep 11, 2012 10:20 am
  • Location: Poland

Re: Encoding video into DNxHD for editing.

PostWed Mar 15, 2017 10:16 am

Igor Vinograd wrote:
Code: Select all
if not exist newfiles md newfiles
for %%A in (*.mp4) do ffmpeg -i "%%A" -r 60000/1001 -s 1920x1080 -c:v libx264 -preset  slow -pix_fmt yuv420p -c:a pcm_s24le -ac 2 -b:a 320k -ar 48000 "newfiles\%%~nA.mov"
pause


The preceding command also eventually gives a "media offline" error while editing.

My machine is a laptop with Core i7 3740QM 2.7GHz processor, 16GB or ram, AMD Radeon HD 7570M and Windows 7 64bit. I'm using ffmpeg downloaded about a month ago. I'm using Resolve 12.5.4.

Andrew Kolakowski wrote:Why are you converting file into h264+ AAC for use in Resolve? This is very bad idea. Use DNxHR or ProRes with PCM.


My original post ask for the best command that would convert to DNxHR using ffmpeg or some other conversion process.


Eventually? It should either show it straight away or not at all. Something is definitely wrong with your machine/Resolve.

ffmpeg -i "source" -c:v dnxhd -profile:v 3 -c:a pcm_s24le 'out.mov" will do 8bit DNxHR.
Offline

Igor Vinograd

  • Posts: 19
  • Joined: Mon Jan 02, 2017 9:21 pm

Re: Encoding video into DNxHD for editing.

PostWed Mar 15, 2017 1:11 pm

Andrew Kolakowski wrote:
Eventually? It should either show it straight away or not at all. Something is definitely wrong with your machine/Resolve.

ffmpeg -i "source" -c:v dnxhd -profile:v 3 -c:a pcm_s24le 'out.mov" will do 8bit DNxHR.


I have 5 clips that i'm experimenting with. I'll re encode them and then edit them together. Some of the encoding schemes will give "media offline" right away, won't even preview it in media tab. The aforementioned command will give media offline errors in the fourth or fifth clips after a bit of editing. The "media offline" also seems contagious, when the later clips throw the error the earlier clips will throw the error too even though they were playing and editing fine at first.

What do you suppose could be wrong?

I have no problems editing Sony video camera footage (with the sound unpacked) which Resolve tells me is in H264. Also the clips that are discussed above edit fine and Resolve tells me that they are also H264 (the only issue here being that a 20min clip takes upwards or 2 hours to deliver).
Offline
User avatar

Cary Knoop

  • Posts: 1654
  • Joined: Sun Mar 12, 2017 6:35 pm
  • Location: Newark, CA USA

Re: Encoding video into DNxHD for editing.

PostWed Mar 15, 2017 1:57 pm

Andrew Kolakowski wrote:No, you can segment and run many instances, but be careful not to miss some frames (specially for 23.976/29.97 etc).
Last time I tried it I had issues due to the way how ffmpeg works (rounded time stamps).
Best is to work with seeking after -i (then you can work in frames), but then you waste time as file has to be decoded up to your in point for each part.
Using -ss before -i is fast but as I said you have to watch not to miss frame (at worse it's just 1 frame).

Thanks!

Andrew Kolakowski wrote:Was it 50/60p UHD sample? These are 4:2:0.

No, it was a UHD 24p 4:2:2 sample.
Offline

Andrew Kolakowski

  • Posts: 9530
  • Joined: Tue Sep 11, 2012 10:20 am
  • Location: Poland

Re: Encoding video into DNxHD for editing.

PostWed Mar 15, 2017 2:33 pm

That's a surprise, but at least good one :)
Offline

Andrew Kolakowski

  • Posts: 9530
  • Joined: Tue Sep 11, 2012 10:20 am
  • Location: Poland

Re: Encoding video into DNxHD for editing.

PostWed Mar 15, 2017 2:35 pm

Igor Vinograd wrote:
Andrew Kolakowski wrote:
Eventually? It should either show it straight away or not at all. Something is definitely wrong with your machine/Resolve.

ffmpeg -i "source" -c:v dnxhd -profile:v 3 -c:a pcm_s24le 'out.mov" will do 8bit DNxHR.


I have 5 clips that i'm experimenting with. I'll re encode them and then edit them together. Some of the encoding schemes will give "media offline" right away, won't even preview it in media tab. The aforementioned command will give media offline errors in the fourth or fifth clips after a bit of editing. The "media offline" also seems contagious, when the later clips throw the error the earlier clips will throw the error too even though they were playing and editing fine at first.

What do you suppose could be wrong?



This is strange and something is definitely not right in your system. Is it Win 7? There were some patches needed for Win 7.
Offline

Igor Vinograd

  • Posts: 19
  • Joined: Mon Jan 02, 2017 9:21 pm

Re: Encoding video into DNxHD for editing.

PostWed Mar 15, 2017 3:52 pm

Andrew Kolakowski wrote:This is strange and something is definitely not right in your system. Is it Win 7? There were some patches needed for Win 7.


Yes i'm using Windows 7. It's fully up to date as far as Microsoft is concerned. Would you happen to know what those patches were?
Offline

Andrew Kolakowski

  • Posts: 9530
  • Joined: Tue Sep 11, 2012 10:20 am
  • Location: Poland

Re: Encoding video into DNxHD for editing.

PostWed Mar 15, 2017 6:58 pm

Search on this forum. It was mentioned few times.
Offline

Martin Schitter

  • Posts: 899
  • Joined: Tue Apr 28, 2015 10:41 pm

Re: Encoding video into DNxHD for editing.

PostWed Mar 15, 2017 7:06 pm

there is also this well known DNxHD/HR specific problem concerning some required processor instructions (SSSE3), which are not available on very old intel hardware and compatible processors from other manufactures.

viewtopic.php?t=39949
Offline

Bryan Worsley

  • Posts: 513
  • Joined: Fri Apr 15, 2016 11:26 am
  • Location: Montreal, Canada

Re: Encoding video into DNxHD for editing.

PostThu Mar 16, 2017 12:52 am

Cary Knoop wrote:
Andrew Kolakowski wrote:I just tried some 4:2:2 10 bit GH5 test footage with the free version of Resolve and it seems to work fine.

That's interesting. The other day I tested some sample 10-bit 422 GH5 clips (24p/30p mp4) and Resolve 12.5.5 wouldn't import them (! Media Offline)

Link for the footage from Neumannfilms:



The download link is cited in the video description.

Direct link:

http://www.mediafire.com/file/m5rrourqi6sp8a1/Neumann_Films_-_Panasonic_GH5_Footage.zip
Offline

codex15

  • Posts: 2
  • Joined: Wed Jan 02, 2019 12:50 am
  • Real Name: John Baird

Re: Encoding video into DNxHD for editing.

PostThu Jan 03, 2019 6:08 pm

I had issues getting my GoPro HERO7 Black HEVC+AAC encoded videos to DaVinci Resolve on Linux. I ended up converting the HEVC video stream to DNxHD (dnxhr_hq profile) and my AAC to PCM.

I ended up using a bash script that uses ffmpeg to encode the streams (and copy over GoPro's metadata streams) into an MOV file that Resolve can use.

Return to DaVinci Resolve

Who is online

Users browsing this forum: bertold, Bing [Bot], cmography, FirePhoenix, Google [Bot], Lucius Snow, panos_mts and 283 guests