Question / Help ffmpeg recording

Johan Blome

New Member
Just updated to 20.1.3 and now I cannot record to ffmpeg.
The strange thing is that I do not get any errors, it even says that it has encode x frames:

info: ==== Recording Start ===============================================
info: Output 'adv_ffmpeg_output': stopping
info: Output 'adv_ffmpeg_output': Total frames output: 484
info: Output 'adv_ffmpeg_output': Total drawn frames: 485
info: ==== Recording Stop ================================================

But, the resulting file has no video at all, only sound. Same setting as in 20.1.1
Using "standard" encoder works fine. Anymone else experienced this?

Question: is it possible to set a different audio encoder when using the standard encoder type?
 
Last edited:

J lowe

New Member
I have a similar issue. For me, when I do Advanced -> Custom Output settings, I get nothing. If launch obs with --debug I see this:
info: ==== Recording Start ===============================================
debug: Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly

debug: Encoder did not produce proper pts, making some up.

info: Output 'adv_ffmpeg_output': stopping
info: Output 'adv_ffmpeg_output': Total frames output: 151
info: Output 'adv_ffmpeg_output': Total drawn frames: 151
info: ==== Recording Stop ================================================

Are you all seeing the same thing under the same conditions?
 

Take Vos

New Member
With OBS set to debug, I don't get those debug statements. I build both ffmpeg and obs-studio from source a couple of day ago though, so maybe those things you encounter are fixed and have nothing to do with the problem we both experience.

Code:
11:33:14 AM.502: ------------------------------------------------
11:33:14 AM.782: adding 42 milliseconds of audio buffering, total audio buffering is now 42 milliseconds
11:33:21 AM.511: ==== Recording Start ===============================================
11:33:24 AM.286: Output 'adv_ffmpeg_output': stopping
11:33:24 AM.286: Output 'adv_ffmpeg_output': Total frames output: 84
11:33:24 AM.286: Output 'adv_ffmpeg_output': Total drawn frames: 86
11:33:24 AM.286: ==== Recording Stop ================================================

I opened the .mp4 file with vlc to see what the codec information is:
Stream 0
  • Type: Video
  • Codec: H264 - MPEG-4 AVC (part 10) (avc1)
  • Resolution: 1536x864
  • Display resolution: 1536x864
  • Frame rate: 12191.250432
Stream 1
  • Type: Audio
  • Codec: MPEG AAC Audio (mp4a)
  • Channels: Stereo
  • Sample rate: 48000 Hz
VLC also dumps the following to stdout:
Code:
[0000000001113148] core libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
[h264 @ 0x7fdd54c55bc0] no frame!
[h264 @ 0x7fdd54cae7a0] no frame!
[h264 @ 0x7fdd54cf5f80] no frame!
[h264 @ 0x7fdd54d3d780] no frame!
[h264 @ 0x7fdd54c55bc0] no frame!
[h264 @ 0x7fdd54cae7a0] no frame!
[h264 @ 0x7fdd54cf5f80] no frame!
[h264 @ 0x7fdd54d3d780] no frame!
[h264 @ 0x7fdd54c55bc0] no frame!
[h264 @ 0x7fdd54cae7a0] no frame!
[h264 @ 0x7fdd54cf5f80] no frame!
....
....
....
 

Take Vos

New Member
I've done some more tests, when using "libx264 (Default Encoder)" I get the following error, and doesn't record anything:
Code:
11:46:56 AM.904: ==== Recording Start ===============================================
11:46:56 AM.919: receive_audio: Error writing packet: Invalid argument
11:46:56 AM.919: Output 'adv_ffmpeg_output': stopping
11:46:56 AM.919: Output 'adv_ffmpeg_output': Total frames output: 1
11:46:56 AM.919: Output 'adv_ffmpeg_output': Total drawn frames: 1
11:46:56 AM.919: ==== Recording Stop ================================================

I also tried the flv container with the "flv (default encoder)" and "ibmp3lame (default encoder)". The same problem with audio without video.
 

J lowe

New Member
I'm at HEAD on both obs and FFMpeg. For what ever reason the debug message does not end up in the log, its only in obs' stdout.

Do these messages get printed in obs for you?
 

pkv

Developer
I'm at HEAD on both obs and FFMpeg. For what ever reason the debug message does not end up in the log, its only in obs' stdout.

Do these messages get printed in obs for you?
could you try with FFmpeg @ 3.4 instead of HEAD to check whether there are the same errors.
There were build issues for obs with ffmpeg head (as of a few weeks ago) due to some deprecated constants; the issues were fixed but I would not be surprised if later heads of ffmpeg have new issues ...
 

J lowe

New Member
If I stayed at obs head and revert to ffmpeg-3.4 obs builds, but I still get the same errors and the output file is trash: pts/dts are sequential.
If I revert obs to a33db9a (w/3.4) obs builds, and the frame pts/dts are being set properly.

I've done some digging in the code and found the offending statement. But wanted to see if other people were encountering the same issue before taking this to mantis.
 

pkv

Developer
ok that would be just before one of my commits with ffmpeg. Just point me here with what you found, i'll test and open a PR to fix that.
Give me also all relevant info on your linux build.
(or you could open a PR yourself; you'll have to test obs head with both ffmpeg head and 3.4, maybe also 3.2 on all three supported os, windows, macos, linux)
ps: there is already a mantis issue : https://obsproject.com/mantis/view.php?id=1070
 
Last edited:

Take Vos

New Member
I've rebuild ffmpeg version 3.2.9 it still has the same problems.

Incuding rebuildin obs head after. Did I miss a pull request?
 
Last edited:

pkv

Developer
I've rebuild ffmpeg version 3.2.9 it still has the same problems.

Incuding rebuildin obs head after. Did I miss a pull request?
i will open a PR solving that; older versions of ffmpeg fail as well as newer ones (on win macos as well as linux).
I have to make some final tests of my PR or if you're in a hurry, you can compile obs from my repo (pick the ffmpeg branch which has the fix)
 

Take Vos

New Member
Okay, that pull request seems to work, I can record and get video.

Only problem and probably another issue is that OBS crashes when stopping the recording. It still shows "Stopping Recording..." and the window remains on the screen, even though all the obs processes had died, never seen that before.

Anyway, I tried three recordings. Two times OBS crashes when stopping the recording.

This is in the log file from the two recordings, no errors, just silent death.
Code:
05:52:36 PM.924: ==== Recording Start ===============================================
05:52:40 PM.153: Output 'adv_ffmpeg_output': stopping
05:52:40 PM.153: Output 'adv_ffmpeg_output': Total frames output: 97
05:52:40 PM.153: Output 'adv_ffmpeg_output': Total drawn frames: 99
05:52:40 PM.153: ==== Recording Stop ================================================
05:52:55 PM.637: ==== Recording Start ===============================================
05:53:10 PM.373: Output 'adv_ffmpeg_output': stopping
05:53:10 PM.373: Output 'adv_ffmpeg_output': Total frames output: 442
05:53:10 PM.373: Output 'adv_ffmpeg_output': Total drawn frames: 444
05:53:10 PM.374: ==== Recording Stop ================================================

I will try to get a core dump.
 

Take Vos

New Member
I redirected obs's stdout and stderr to a file, and set ulimit - c unlimited. Now it doesn't crash anymore. So never mind I guess.
 

pkv

Developer
yeah strange, I haven't seen that during my tests. The binary executes without crash (ubuntu 17.10 x64) with ffmpeg head or ffmpeg 3.4.1
 
Top