Genymobile / scrcpy

Display and control your Android device
Apache License 2.0
109.18k stars 10.5k forks source link

WARN: [FFmpeg] track 1: codec frame size is not set #4309

Open macasas opened 12 months ago

macasas commented 12 months ago

Environment macOS 12.6 scrcpy 2.1.1 https://github.com/Genymobile/scrcpy

Dependencies (compiled / linked):

Describe the bug Running various variations of scrcpy --always-on-top --record=junction_idea2.mp4 --time-limit=300 --audio-codec=aac --audio-encoder=c2.android.aac.encoder --disable-screensaver --fullscreen --require-audio

With or without audio-codec and audio-encoder.

Records video fine, but never any audio Suspect WARN: [FFmpeg] track 1: codec frame size is not set. but cannot find a way to set this nor at https://developer.android.com/reference/android/media/MediaFormat

scrcpy 2.1.1 <https://github.com/Genymobile/scrcpy>
INFO: ADB device found:
INFO:     -->   (usb)  R52W10A5KJZ                     device  SM_X906B
/usr/local/Cellar/scrcpy/2.1.1/share/scrcpy/scrcpy-server: 1 file pushed, 0 skipped. 28.7 MB/s (56995 bytes in 0.002s)
[server] INFO: Device: [samsung] samsung SM-X906B (Android 13)
INFO: Recording started to mp4 file: junction_idea2.mp4
INFO: Renderer: metal
INFO: Texture: 2960x1848
WARN: [FFmpeg] track 1: codec frame size is not set
^CWARN: Device disconnected  (When I press Ctrl-C to end)
INFO: Recording complete to mp4 file: junction_idea2.mp4

How to get audio?

rom1v commented 12 months ago

WARN: [FFmpeg] track 1: codec frame size is not set

This warning is "expected" (MediaCodec does not provide the audio frame size), and is harmless.

Records video fine, but never any audio

Do you have audio when you don't record?

What player do you use to play your recorded file? Try with VLC (or even Firefox).

macasas commented 12 months ago

I have tried this on my Oppo phone and Samsung S8 tablet. Different microphones with cable and bluetooth connections.

When I just run scrcpy from Terminal I get the video on screen, but where am I going to see an audio signal/feed to know if I have audio? There is nothing except MacBook Microphone as input options in Sound Preferences. I thought the only place would be in the scrcpy recording, but theres no audio in VLC, quicktime or just quick preview is there any audio. Load a recording into a video editor and there is nothing in the audio track.

MP4 is being saved to MacBook, which seems to be against readme description of it being saved onto android device.

Sorry if I’m just not understanding how to use scrcpy, but am left screen mirroring to macbook and recording audio on that directly.

On 24 Sep 2023, at 22:41, Romain Vimont @.***> wrote:

WARN: [FFmpeg] track 1: codec frame size is not set

This warning is "expected" (MediaCodec does not provide the audio frame size), and is harmless.

Records video fine, but never any audio

Do you have audio when you don't record?

What player do you use to play your recorded file? Try with VLC (or even Firefox).

— Reply to this email directly, view it on GitHub https://github.com/Genymobile/scrcpy/issues/4309#issuecomment-1732675887, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAG6GAV6FUX4GFB2PMHPLLTX4CSJXANCNFSM6AAAAAA5DKVV7M. You are receiving this because you authored the thread.

rom1v commented 12 months ago

When I just run scrcpy from Terminal I get the video on screen, but where am I going to see an audio signal/feed to know if I have audio?

Audio forwarding means that the Android device audio output (for example if you play a video on your device) is played on your computer on the default audio output.

I thought the only place would be in the scrcpy recording, but theres no audio in VLC, quicktime or just quick preview is there any audio. Load a recording into a video editor and there is nothing in the audio track.

OK so it seems your audio is not recorded on your device for some reason. Do you have any bluetooth earphones connected on the device (they might disable audio capture on the device)?

MP4 is being saved to MacBook, which seems to be against readme description of it being saved onto android device.

In scrcpy, the file is recorded on the computer.

macasas commented 12 months ago

Okay, Samsung S8 doesn’t have 3.5mm jack so have been using bluetooth headset, but I will try using its own microphone and perhaps a USB-C connection? Not sure. I will let you know how that goes. Its true the bluetooth headset does not record audio on numerous android voice recorder apps, but today I was using 4 different cabled mics into oppo and none of them gave me audio.

On 25 Sep 2023, at 14:05, Romain Vimont @.***> wrote:

When I just run scrcpy from Terminal I get the video on screen, but where am I going to see an audio signal/feed to know if I have audio?

Audio forwarding means that the Android device audio output (for example if you play a video on your device) is played on your computer on the default audio output.

I thought the only place would be in the scrcpy recording, but theres no audio in VLC, quicktime or just quick preview is there any audio. Load a recording into a video editor and there is nothing in the audio track.

OK so it seems your audio is not recorded on your device for some reason. Do you have any bluetooth earphones connected on the device (they might disable audio capture on the device)?

MP4 is being saved to MacBook, which seems to be against readme description of it being saved onto android device.

In scrcpy, the file is recorded on the computer.

— Reply to this email directly, view it on GitHub https://github.com/Genymobile/scrcpy/issues/4309#issuecomment-1733673403, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAG6GAWMMQZTL2KI5UMHILTX4F6RNANCNFSM6AAAAAA5DKVV7M. You are receiving this because you authored the thread.

macasas commented 12 months ago

Oppo phone usb connected to MacBook Run scrcpy Nothing in 3.5mm jack on phone, headphones in MacBook Audio forwarding Playing a video on device, audio is routed to MacBook headphones

Open voice recorder on phone Plug another earphone with mic into phone. Hit record It’s recording voice through earpiece mic, not phone mic But when I playback, its playing back though earpiece headphone, not routing through usb to MacBook

Ultiimately i am trying to record the screen of the tablet while talking about what I am sketching. The app being used is a drawing app, so I’m not sure what will be listening to the phone mic, or cable of routing it because no apps are running to do that.

I have the phone in developer mode, usb audio routing is not disabled. Not sure if any of that is relevant. I will continue to use it as screen monitoring only and record the audio from the MacBook running a screen grab app.

On 25 Sep 2023, at 16:32, David MacDougall @.***> wrote:

Okay, Samsung S8 doesn’t have 3.5mm jack so have been using bluetooth headset, but I will try using its own microphone and perhaps a USB-C connection? Not sure. I will let you know how that goes. Its true the bluetooth headset does not record audio on numerous android voice recorder apps, but today I was using 4 different cabled mics into oppo and none of them gave me audio.

On 25 Sep 2023, at 14:05, Romain Vimont @. @.>> wrote:

When I just run scrcpy from Terminal I get the video on screen, but where am I going to see an audio signal/feed to know if I have audio?

Audio forwarding means that the Android device audio output (for example if you play a video on your device) is played on your computer on the default audio output.

I thought the only place would be in the scrcpy recording, but theres no audio in VLC, quicktime or just quick preview is there any audio. Load a recording into a video editor and there is nothing in the audio track.

OK so it seems your audio is not recorded on your device for some reason. Do you have any bluetooth earphones connected on the device (they might disable audio capture on the device)?

MP4 is being saved to MacBook, which seems to be against readme description of it being saved onto android device.

In scrcpy, the file is recorded on the computer.

— Reply to this email directly, view it on GitHub https://github.com/Genymobile/scrcpy/issues/4309#issuecomment-1733673403, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAG6GAWMMQZTL2KI5UMHILTX4F6RNANCNFSM6AAAAAA5DKVV7M. You are receiving this because you authored the thread.

rom1v commented 12 months ago

Ultiimately i am trying to record the screen of the tablet while talking about what I am sketching.

Do not connect any bluetooth earphone, and use:

scrcpy --audio-source=mic --record=file.mp4

(you will get the device screen capture with the audio capture from your phone microphone)

macasas commented 12 months ago

Okay thanks, technically this is now passing the tablet microphone through to the MacBook, but the tablet microphone is not useable to record my voice, its extremely sensitive picking up every little noise and movement, so because the S8 does not have a microphone input connection except bluetooth, or usb (but that’s in use with scrcpy), and scrcpy only seems to work with the built in mic, I guess I’m back to the start. Android does seem to have many issues with bluetooth microphones which makes me wonder why Samsung chose to leave out the 3.5 connector. I do still love the screen mirroring, so easy to use, no lag, better than all the other apps I tried.

On 25 Sep 2023, at 18:26, Romain Vimont @.***> wrote:

Ultiimately i am trying to record the screen of the tablet while talking about what I am sketching.

Do not connect any bluetooth earphone, and use:

scrcpy --audio-source=mic --record=file.mp4 (you will get the device screen capture with the audio capture from your phone microphone)

— Reply to this email directly, view it on GitHub https://github.com/Genymobile/scrcpy/issues/4309#issuecomment-1734175278, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAG6GAT4MXC4RL6G7MR7KXDX4G5FJANCNFSM6AAAAAA5DKVV7M. You are receiving this because you authored the thread.

Lerduzz commented 1 month ago

I have the same warning but my Galaxy S23 Ultra does record audio and video fine.

Screen res 1080x2312 for reference.