[mythtv-users] Audio source not available to ExternalRecorder in LiveTV

Robert LeBlanc robert at leblancnet.us
Thu Dec 6 19:15:23 UTC 2018


Okay, Looks like capturing the Pulse source works fine. I'll just have to
resolve the audio down to the Pulse device. I'll clean up the code a little
bit more and put it on github if anyone finds it useful.
----------------
Robert LeBlanc
PGP Fingerprint 79A2 9CA4 6CC4 45DD A904  C70E E654 3BB2 FA62 B9F1


On Thu, Dec 6, 2018 at 11:19 AM Robert LeBlanc <robert at leblancnet.us> wrote:

> The only issue I've run into with ffmpeg is sometimes the V4l2 buffer is
> not ready. I'm watching for that and relaunching ffmepg if that happens. My
> ffmpeg command is:
> 2018-12-06 10:45:00,247 DEBUG - mythuc.py:194 - __init__() ffmpeg command:
> ffmpeg -f v4l2 -video_size 1920x1200 -framerate 60.0 -input_format yuyv422
> -thread_queue_size 2048 -i /dev/video0 -f alsa -thread_queue_size 2048 -i
> hw:1,0 -map 0:v -map 1:a -f mpegts -acodec mp3 -loglevel error -pix_fmt
> yuv420p -preset superfast -vcodec libx264 - -nostdin
>
> Here is my logs when the v4l2 buffer isn't ready:
> 2018-12-06 10:45:00,259 DEBUG - mythuc.py:209 - start() Wating for ffmpeg
> to warm up.
> 2018-12-06 10:45:00,600 DEBUG - mythuc.py:278 - loggy() Ffmpeg:
> b'[video4linux2,v4l2 @ 0x556843eeaf00] Dequeued v4l2 buffer contains
> 1579180 bytes, but 4608000 were expected. Flags: 0x00012001.\n'
> 2018-12-06 10:45:00,600 WARNING - mythuc.py:280 - loggy() Ffmpeg not
> getting v4l2 stream. Going to restart ffmpeg...
> 2018-12-06 10:45:00,601 DEBUG - mythuc.py:212 - start() ffmpeg warmed up
> with state: ERROR
> 2018-12-06 10:45:00,601 DEBUG - mythuc.py:215 - start() Ffmpeg in error
> state. Restart (1)
> 2018-12-06 10:45:00,602 DEBUG - mythuc.py:217 - start() ffmpeg sent
> terminate
> 2018-12-06 10:45:01,352 INFO - mythuc.py:304 - adjust_chunksize() Stream
> read block size changed from 54400 to 48692
> 2018-12-06 10:45:01,368 DEBUG - mythuc.py:219 - start() Restarting
> FFmpeg...
> 2018-12-06 10:45:01,372 DEBUG - mythuc.py:271 - loggy() Loggy thread
> running...
> 2018-12-06 10:45:01,373 DEBUG - mythuc.py:209 - start() Wating for ffmpeg
> to warm up.
> 2018-12-06 10:45:01,674 DEBUG - mythuc.py:278 - loggy() Ffmpeg: b'[alsa @
> 0x5625c200b500] cannot open audio device hw:1,0 (Device or resource
> busy)\n'
> 2018-12-06 10:45:01,674 DEBUG - mythuc.py:278 - loggy() Ffmpeg: b'hw:1,0:
> Input/output error\n'
> 2018-12-06 10:45:02,108 INFO - mythuc.py:304 - adjust_chunksize() Stream
> read block size changed from 48692 to 52640
> 2018-12-06 10:45:02,308 INFO - mythuc.py:304 - adjust_chunksize() Stream
> read block size changed from 52640 to 57904
> 2018-12-06 10:45:02,373 DEBUG - mythuc.py:212 - start() ffmpeg warmed up
> with state: INIT
> 2018-12-06 10:45:02,374 DEBUG - mythuc.py:99 - ms_run() MythtvSend main
> thread starting...
> 2018-12-06 10:45:02,374 DEBUG - mythuc.py:415 - cmd_resp() Command reply:
> OK:Started
> 2018-12-06 10:45:02,375 INFO - mythuc.py:439 - get_cmd() Received command:
> 'XON'
> 2018-12-06 10:45:02,376 DEBUG - mythuc.py:415 - cmd_resp() Command reply:
> OK
> 2018-12-06 10:45:02,509 INFO - mythuc.py:304 - adjust_chunksize() Stream
> read block size changed from 57904 to 63168
> 2018-12-06 10:45:02,709 INFO - mythuc.py:304 - adjust_chunksize() Stream
> read block size changed from 63168 to 126336
> 2018-12-06 10:45:02,910 INFO - mythuc.py:304 - adjust_chunksize() Stream
> read block size changed from 126336 to 252672
> 2018-12-06 10:45:03,110 INFO - mythuc.py:304 - adjust_chunksize() Stream
> read block size changed from 252672 to 505344
> 2018-12-06 10:45:03,311 INFO - mythuc.py:304 - adjust_chunksize() Stream
> read block size changed from 505344 to 1010688
> 2018-12-06 10:45:03,511 INFO - mythuc.py:304 - adjust_chunksize() Stream
> read block size changed from 1010688 to 1048576
> 2018-12-06 10:50:00,320 INFO - mythuc.py:439 - get_cmd() Received command:
> 'CloseRecorder'
> 2018-12-06 10:50:00,320 INFO - mythuc.py:243 - close() Shutting down
> ffmpeg
> 2018-12-06 10:50:00,321 INFO - mythuc.py:252 - close() Ffmpeg shut down
> successfully.
> 2018-12-06 10:50:00,321 INFO - mythuc.py:84 - close() Shutting down the
> MythTV sender.
> 2018-12-06 10:50:00,321 INFO - mythuc.py:96 - close() MythTV sender queue
> drained.
> 2018-12-06 10:50:00,321 DEBUG - mythuc.py:415 - cmd_resp() Command reply:
> OK:Terminating
>
> ----------------
> Robert LeBlanc
> PGP Fingerprint 79A2 9CA4 6CC4 45DD A904  C70E E654 3BB2 FA62 B9F1
>
>
> On Thu, Dec 6, 2018 at 10:55 AM John P Poet <jppoet at gmail.com> wrote:
>
>> On Thu, Dec 6, 2018 at 10:48 AM Robert LeBlanc <robert at leblancnet.us>
>> wrote:
>>
>>> I've got just about everything set up to capture from my USB capture
>>> device. When my script is run from Mythbackend, the hw:1 device is not
>>> available to my recorder script when watching LiveTV (frontend on the same
>>> box). When I run the script stand alone with Mythbackend and Mythfrontend
>>> running but not watching LiveTV get both video and audio. I tried setting
>>> the Mythfrontend to use the null sound device and it still holds on to
>>> hw:1. I tried both hw:1 and hw:1,0 with the same results.
>>>
>>> The backend segfaults probably because of a corrupted stream from ffmpeg
>>> because of this. If I don't try to capture the audio, then I can see the
>>> LiveTV stream just fine of course there is no audio.
>>>
>>>  Any ideas how to get around this problem?
>>>
>>> Here is some logs from my ExternalRecorder script.
>>>
>>> 2018-12-06 10:25:20,226 DEBUG - mythuc.py:209 - start() Wating for
>>> ffmpeg to warm up.
>>> 2018-12-06 10:25:20,506 DEBUG - mythuc.py:278 - loggy() Ffmpeg: b'[alsa
>>> @ 0x55838b4c2500] cannot open audio device hw:1,0 (Device or resource
>>> busy)\n'
>>> 2018-12-06 10:25:20,506 DEBUG - mythuc.py:278 - loggy() Ffmpeg:
>>> b'hw:1,0: Input/output error\n'
>>> 2018-12-06 10:25:20,728 INFO - mythuc.py:304 - adjust_chunksize() Stream
>>> read block size changed from 48692 to 52640
>>> 2018-12-06 10:25:20,929 INFO - mythuc.py:304 - adjust_chunksize() Stream
>>> read block size changed from 52640 to 57904
>>>
>>> Scheduling a recording and not running Mythfrontend also has the same
>>> error opening the audio device, so it must be something with the backend.
>>> There is only the one Capture device (ExternalRecorder) configured so I'm
>>> not sure why Mythbackend is even messing with that device. I'm running 29.1
>>> from deb-multimedia(mythbackend version:  [v29.1] www.mythtv.org)
>>>
>>
>> Can you post the complete ffmpeg command with arguments that you are
>> using?   At least when I was playing around with mythexternrecorder
>> configurations (https://www.mythtv.org/wiki/ExternalRecorder and
>> https://www.mythtv.org/wiki/Example_Configuration_files) I found that
>> using cvlc was much more reliable than ffmpeg, so you may want to try that.
>>
>> John
>> _______________________________________________
>> mythtv-users mailing list
>> mythtv-users at mythtv.org
>> http://lists.mythtv.org/mailman/listinfo/mythtv-users
>> http://wiki.mythtv.org/Mailing_List_etiquette
>> MythTV Forums: https://forum.mythtv.org
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mythtv.org/pipermail/mythtv-users/attachments/20181206/d124141d/attachment.html>


More information about the mythtv-users mailing list