Question / Help OBS QuickSync Encoded Footage Unusable In Premiere Pro

Mavflight09

New Member
Hey guys,

I have a mild issue, any footage I record using Intel QuickSync as an encoder comes out unusable in Premiere Pro.
Here is a example: https://youtu.be/YlQPZlIn2pU

Does anyone know how to fix this issue? Or is QuickSync just bad and not recommended?
 

Attachments

  • QuickSync Encoding.txt
    13.7 KB · Views: 32
Last edited:

Harold

Active Member
Try saving to FLV or MKV and remuxing the recording after you're done instead of saving to mov.
 

Mavflight09

New Member
Try saving to FLV or MKV and remuxing the recording after you're done instead of saving to mov.

Do you know of any easy way to "batch" remux files? As in point a program to a folder full of MKV's and it will output to a folder with all of them turned into mp4's? I noticed that OBS can't do this. Would HandBrake be a viable option? Though from what I've gathered HandBreak is for re-encoding not remuxing.
 

Harold

Active Member
there are batch scripts for ffmpeg that can do folder remuxing.
Handbrake, although capable of batch processing, is indeed more for re-encoding.

Code:
#!/bin/bash
for i in *.flv
do
ffmpeg -i "$i" -c copy -copyts "${i%flv}mp4"
done
This on a linux box for example would remux all flvs in the folder of the command.
 

koala

Active Member
Here is a simple batch file for Windows for converting *.flv to *.mp4.
You need to install ffmpeg.
In the script, replace the actual path to ffmpeg.exe.
It will convert files in the directory where the script is located.
It will delete the source files after successful conversion.

Save as flv2mp4.cmd:
Code:
rem remux (not recode) every *.flv to *.mp4

setlocal ENABLEDELAYEDEXPANSION
set ffmpeg="D:\Programme\ffmpeg\bin\ffmpeg.exe"

for %%f in (*.flv) do (
  set source=%%f
  set dest=%%~nf.mp4
  echo source=!source! dest=!dest!
  if not exist "!dest!" (
    %ffmpeg% -i "!source!" -vcodec copy -acodec copy -copyts "!dest!"
    if not errorlevel 1 (
      del "!source!"
      echo file was converted successfully
    ) else (
      del "!dest!"
      echo error converting file
    )
  )
)
 

Mavflight09

New Member
Well guys, I tried recording to mkv and then remuxing that into mp4 using OBS to use in Premiere Pro.

Just watching the playback in VLC I was hopeful because all of the artifacts that I got when recording to mov were gone.

But dropping the remuxed mp4 into Premiere Pro I found the exact same issue. This could be placebo but it appears that it happens less often then when I recorded to mov.
 

Mavflight09

New Member
Here is a simple batch file for Windows for converting *.flv to *.mp4.
You need to install ffmpeg.
In the script, replace the actual path to ffmpeg.exe.
It will convert files in the directory where the script is located.
It will delete the source files after successful conversion.

Save as flv2mp4.cmd:
Code:
rem remux (not recode) every *.flv to *.mp4

setlocal ENABLEDELAYEDEXPANSION
set ffmpeg="D:\Programme\ffmpeg\bin\ffmpeg.exe"

for %%f in (*.flv) do (
  set source=%%f
  set dest=%%~nf.mp4
  echo source=!source! dest=!dest!
  if not exist "!dest!" (
    %ffmpeg% -i "!source!" -vcodec copy -acodec copy -copyts "!dest!"
    if not errorlevel 1 (
      del "!source!"
      echo file was converted successfully
    ) else (
      del "!dest!"
      echo error converting file
    )
  )
)

Is there any way I can edit your code to add individual source and destination folders without the .bat file being in the source folder?

I would like to be able to run the .bat file off of my desktop and have it take all .mkv files from "E:\.MKV OBS Videos" and remux them into .mp4 and put them into "I:\OBS Videos".

With my extremely limited knowledge of coding (literally watched one, 10min video about it years ago) doesn't the 'set' command set a variable? Would I be able to set the source folder and output folder as said variables and the code to work?

Sadly it didn't but if you could explain what I did wrong that would be great.

This is what I ended up with:

Code:
rem remux (not recode) every *.mkv to *.mp4

setlocal ENABLEDELAYEDEXPANSION
set ffmpeg="C:\Program Files (x86)\ffmpeg\bin\ffmpeg.exe"

for %%f in (*.mkv) do (
  set source="E:\.MKV OBS Videos\%%f"
  set dest="I:\Test Output\%%~nf.mp4"
  echo source=!source! dest=!dest!
  if not exist "!dest!" (
    %ffmpeg% -i "!source!" -vcodec copy -acodec copy -copyts "!dest!"
    if not errorlevel 1 (
      del "!source!"
      echo File was converted successfully
    ) else (
      del "!dest!"
      echo Error converting file
      pause
    )
  )
)

I did get this to work: (but the .bat has to be in the same directory as the files I want to convert, and it doesn't delete them when it's done)

Code:
for %%a in ("*.mkv") do ffmpeg -i "%%a" -vcodec copy -acodec copy "I:\Test Output\%%~na.mp4"
pause
 

ElectroStingz

New Member
Hello,

Have you played around with the Keyframe Interval setting / Async Depth?
Lower the Keyframe Interval to 2 or 1 and see what happens.
 

Mavflight09

New Member
Hello,

Have you played around with the Keyframe Interval setting / Async Depth?
Lower the Keyframe Interval to 2 or 1 and see what happens.

Keyframe interval was on 2 so I set it to 1.

Doesn't seem to have made a big difference.

Do you have any recommendations as to what I should set Async Depth to?

From a few other OBS help threads everyone just said don't touch it.
 

ElectroStingz

New Member
Async depth, lower to reduce latency so try 1.

If this makes no difference the issue may be the B-frames which is an option missing in OBS for Quick Sync :(
 

Mavflight09

New Member
Async depth, lower to reduce latency so try 1.

If this makes no difference the issue may be the B-frames which is an option missing in OBS for Quick Sync :(

I tried with async depth on 1 but I get a "failed to start output" error, then I tried again and OBS crashed...

I tried again with async depth on 2 and it seems to work fine.

I think changing from recording to mov to mkv is what fixed the issue, although I'm going to need to test it some more.
 

Attachments

  • 2018-08-25 11-50-56.txt
    5.9 KB · Views: 19

Suslik V

Active Member

Mavflight09

New Member
@ElectroStingz Control over B-frames quite possible by modifying "recordEncoder.json" file by adding "bf": 2 string in case of QuickSync (equivalent of bframes=2 or something else entered in the "x264 options" field when x264 was active). See https://obsproject.com/forum/threads/comparison-of-x264-nvenc-quicksync-vce.57358/page-4#post-312000 for details. Don't forget to remove this parameter later (it affects Software x264 encoder too).

Does this only effect the currently active profile? Or does it effect all profiles?
 

ElectroStingz

New Member
@ElectroStingz Control over B-frames quite possible by modifying "recordEncoder.json" file by adding "bf": 2 string in case of QuickSync (equivalent of bframes=2 or something else entered in the "x264 options" field when x264 was active). See https://obsproject.com/forum/threads/comparison-of-x264-nvenc-quicksync-vce.57358/page-4#post-312000 for details. Don't forget to remove this parameter later (it affects Software x264 encoder too).

Thanks for the info, looking into it.
 

Suslik V

Active Member
@Mavflight09 Only the profile where you made the changes in .json file affected (look for folder's name where you modifying strings). I hope that you have more than 1 profile in OBS Studio. Also, you need to make changes to current profile settings (set "CRF" for example to 18) only then the .json file will be created by OBS Studio for this profile.
 

Mavflight09

New Member
there are batch scripts for ffmpeg that can do folder remuxing.
Handbrake, although capable of batch processing, is indeed more for re-encoding.

Code:
#!/bin/bash
for i in *.flv
do
ffmpeg -i "$i" -c copy -copyts "${i%flv}mp4"
done
This on a linux box for example would remux all flvs in the folder of the command.

I took @koala's code and tried to modify it a bit but I ran into an issue and was wondering if you could help.

The batch file works if it is placed in the same directory as the files I'm trying to convert, but I want to be able to run this from my desktop without having to copy the batch file to the folder of videos I want to remux.

My problem is that if I place the batch file on my desktop with the source variable set as the source folder the batch file opens and then immediately closes and ignores my pause command even when set at the end.

Code:
setlocal ENABLEDELAYEDEXPANSION
set ffmpeg="C:\Program Files (x86)\ffmpeg\bin\ffmpeg.exe"

for %%f in (*.mkv) do (
  set source=E:\.MKV OBS Videos\%%f
  set dest=I:\Test Output\%%~nf.mp4
  echo source=!source! dest=!dest!
  if not exist "!dest!" (
    %ffmpeg% -i "!source!" -vcodec copy -acodec copy -copyts "!dest!"
    if not errorlevel 1 (
      del "!source!"
      echo File was converted successfully
    ) else (
      del "!dest!"
      echo Error converting file    
      pause
    )
  )
)
 

koala

Active Member
I really don't like to write batch files for people who don't understand a word in it, because from experience I know they are usually unable to make sane and necessary changes themselves and ask more and more trivial options ("just add one more thing for me, very tiny change...".

This is the only expansion I'm going to provide. You can set source and destination directory, source and destination extension, and you can choose to not delete the source file (set delafter to something else than yes).

Code:
@echo off

rem remux every *.flv to *.mp4 without recoding

setlocal ENABLEDELAYEDEXPANSION
set ffmpeg=C:\Program Files (x86)\ffmpeg\bin\ffmpeg.exe
set sourcedir=D:\Dateien\Alex\Videos\Aufzeichnungen\source
set destdir=D:\Dateien\Alex\Videos\Aufzeichnungen\dest
set sourceext=flv
set destext=mp4
set delafter=yes

for %%f in (%sourcedir%\*.%sourceext%) do (
  set source=%%f
  set dest=%destdir%\%%~nf.%destext%
  echo source=!source! dest=!dest!
  if not exist "!dest!" (
    "%ffmpeg%" -i "!source!" -vcodec copy -acodec copy -copyts "!dest!"
    if not errorlevel 1 (
      if %delafter%X==yesX del "!source!"
      echo file was converted successfully
    ) else (
      del "!dest!"
      echo error converting file
    )
  )
)

Someone made native script that runs within the scripting engine of OBS. It claims it starts converting immediately after a recorded file is closed after recording:
https://obsproject.com/forum/resources/automatic-ffmpeg-re-encoding.683/
I didn't try it. I don't know if it works. I assume it can remux instead of transcode if you replace its default "Ffmpeg flags" setting with "-vcodec copy -acodec copy -copyts".
 
Top