AVPlayer send AVPlayerItemFailedToPlayToEndTimeNotification with about 1 min of playback left - avplayer

I am trying hls streaming on Mac. For some contents playback doesn't reach till end and AVPlayer sends AVPlayerItemFailedToPlayToEndTimeNotification signal around 1 min of playback left. It always happens around same time.
AVPlayer gets playlist with starting segment =100. It plays fine for about 16 mins in an 18 min video. and then it fails with AVPlayerItemFailedToPlayToEndTimeNotification.
Here is the AVPlayerItem errorlog
error log: #Version: 1.0
Software: AppleCoreMedia/1.0.0.13E28 (Macintosh; U; Intel Mac OS X 10_9_4; en_us)
#Date: 2014/11/14 12:32:17.017
#Fields: date time uri cs-guid s-ip status domain comment
2014/11/14 12:32:15.015 http://localhost:12000/stream/content.ts?id=192.168.1.107-bd1ec9ddb674b1c67dd4&bps=1200000&segid=100 B4A5AB49-1647-4A3B-9768-61F3F99B133E 127.0.0.1 -12318 "CoreMediaErrorDomain" "Segment exceeds specified bandwidth for variant"
In the error logs it complains about segment 100 which was played 16 mins ago. It looks like its old error info.
Here is the access log info when the playback fails
Access log: #Version: 1.0
#Software: AppleCoreMedia/1.0.0.13E28 (Macintosh; U; Intel Mac OS X 10_9_4; en_us)
#Date: 2014/11/14 12:32:17.017
#Fields: date time uri cs-guid s-ip s-ip-changes sc-count c-duration-downloaded c-start-time c-duration-watched bytes c-observed-bitrate sc-indicated-bitrate c-stalls c-frames-dropped c-startup-time c-overdue c-reason c-observed-min-bitrate c-observed-max-bitrate c-observed-bitrate-sd s-playback-type sc-wwan-count c-switch-bitrate
2014/11/14 12:32:15.015 https://localhost:12100/stream/playlist.m3u8?id=192.168.1.107-bd1ec9ddb674b1c67dd4&bps=1200000 B4A5AB49-1647-4A3B-9768-61F3F99B133E 127.0.0.1 0 3 9.000 1.070 1.281 1831920 5991597.824 1369642 0 0 2.430 0 - 3063099.199 6966103.615 - VOD 0 -
I have compared the access log for AVPlayerItem when the playback fails vs playback is OK (I dump state when playback is paused) and the only notable difference is c-reason field which is 1 in case of failure and - in case of success.
What is c-reason field and where can I get more information on that. AVPlayerItemAccessLogEvent doesn't say anything about it.
Here is the comparision of AVPlayerItemAccessLogEvent fields for fail and success cases. The first value is fail case and second is success case.
uri = https://localhost:12100/stream/playlist.m3u8?id=192.168.1.107-bd1ec9ddb674b1c67dd4&bps=1200000
https://localhost:12100/stream/playlist.m3u8?id=192.168.1.107-bd1ec9ddb674b1c67dd4&bps=1200000
cs-guid = 9B6DFB28-0AB5-4729-9744-5DD1C80AA974
B4A5AB49-1647-4A3B-9768-61F3F99B133E
s-ip = 127.0.0.1
= 127.0.0.1
s-ip-changes = 0
= 0
sc-count = 4
= 3
c-duration-downloaded = 12.000
= 9.000
c-start-time = 1.070
= 1.070
c-duration-watched = 3.948
= 1.281
bytes = 2368360
= 1831920
c-observed-bitrate = 4311328.532
= 5991597.824
sc-indicated-bitrate = 1369642
=1369642
c-stalls =0
= 0
c-frames-dropped = 0
= 0
c-startup-time = 2.574
= 2.430
c-overdue = 0
= 0
c-reason = 1
= -
c-observed-min-bitrate = 2987149.809
= 3063099.199
c-observed-max-bitrate = 6577841.971
= 6966103.615
c-observed-bitrate-sd = - -
s-playback-type = VOD VOD
sc-wwan-count = 0 0
c-switch-bitrate = - -
I know its long question but if someone can check the difference above let me know why the player fails.
Thanks for reading through this long question.
Regards,
D

Related

Converting video to images using OpenCV library problem

I have this code which converts .mov videos to images with the specified frequency (e.g. every 30 seconds here).
import cv2
# the path to take the video from
vidcap = cv2.VideoCapture(r"C:\Users\me\Camera_videos\Images_30sec\PIR-206_7.MOV")
def getFrame(sec):
vidcap.set(cv2.CAP_PROP_POS_MSEC,sec*1000)
hasFrames,image = vidcap.read()
if hasFrames:
cv2.imwrite("image"+str(count)+".jpg", image) # save frame as JPG file
return hasFrames
sec = 0
frameRate = 30 #//it will capture image every 30 seconds
count= 1
success = getFrame(sec)
while success:
count = count + 1
sec = sec + frameRate
sec = round(sec, 2)
success = getFrame(sec)
I have no problem with smaller files. A 5min long .mov file for example, produces 11 images as expected (5 x 60 seconds / 30 seconds = about 10 images with the first image taken at 0 seconds).
However, when I tried a bigger file, which is 483 MB and is about 32mins long, I have encountered a problem.
It is expected to generate some 32 x 60/30 = 64 images.
However, it runs and runs generating some 40'000 images until I manually stop the program. it seems to be stuck at one of the last images??
I have uploaded both .mov files to my google drive, if anyone wants to have a look.
small file
https://drive.google.com/file/d/1guKtLgM-vwt-5fG3_suJrhVbtwMSjMQe/view?usp=sharing
large file
https://drive.google.com/file/d/1V_HVRM29qwlsU0vCyWiOuBP-tkjdokul/view?usp=sharing
Can somebody advise on what's going on here?

Is there a way to check the volume level of all processes with pipewire/pulseaudio?

I'm trying to find a way to check if i have any desktop audio AND what processes is producing sounds.
After some searching i found a way to list all the sink input in pipewire/pulseaudio using pactl list sink-inputs however i have no idea if that input is muted or not
example output:
Sink Input #512
Driver: protocol-native.c
Owner Module: 9
Client: 795
Sink: 1
Sample Specification: float32le 2ch 48000Hz
Channel Map: front-left,front-right
Format: pcm, format.sample_format = "\"float32le\"" format.rate = "48000" format.channels = "2" format.channel_map = "\"front-left,front-right\""
Corked: yes
Mute: no
Volume: front-left: 43565 / 66% / -10.64 dB, front-right: 43565 / 66% / -10.64 dB
balance 0.00
Buffer Latency: 165979 usec
Sink Latency: 75770 usec
Resample method: speex-float-1
Properties:
media.name = "Polish cow (English Lyrics Full Version) - YouTube"
application.name = "Firefox"
native-protocol.peer = "UNIX socket client"
native-protocol.version = "35"
application.process.id = "612271"
application.process.user = "user"
application.process.host = "host"
application.process.binary = "firefox"
application.language = "en_US.UTF-8"
window.x11.display = ":0"
application.process.machine_id = "93e71eeba04e43789f0972b7ea0e4b39"
application.process.session_id = "2"
application.icon_name = "firefox"
module-stream-restore.id = "sink-input-by-application-name:Firefox"
The obvious thing would be looking at the Mute and Volume line but that is not reliable at all, currently the youtube video is paused but Mute is show as no and Volume is still no different from when the youtube video is actually playing.
I need the solution to be script-able since I'll muting certain thing when there is another process that is making sounds, and play it again when there is no sound, using bash script. If it is not possible on pipewire/pulseaudio but it is possible with another sound server then please do tell me.

Micropython code displaying red-white noise on 1.54" ePaper display

I have the following code in micropython that is running on my Espressif ESP32-PICO-KIT. To this I have attached a WaveShare 1.54" ePaper display (supporting red color).
When I reach the last line the display updates in waves, but I only get white-red noise on the display.
I'm using the driver from mcauser/micropython-waveshare-epaper on Github.
This is my code:
from machine import Pin, SoftSPI
import epaper1in54b
miso = Pin(19)
sck = Pin(18) # yellow
mosi = Pin(23) # white
cs = Pin(5) # green
dc = Pin(25) # gray
rst = Pin(21) # orange
busy = Pin(19) # gray
spi = SoftSPI(baudrate=20000000, polarity=0, phase=0, sck=sck, mosi=mosi, miso=miso)
e = epaper1in54b.EPD(spi, cs, dc, rst, busy)
e.init()
w = 200
h = 200
x = 0
y = 0
import framebuf
buf = bytearray(w * h // 8)
fb = framebuf.FrameBuffer(buf, w, h, framebuf.MONO_VLSB)
black = 0
white = 1
red = 2
fb.fill(white)
fb.text('Hello world!', 0, 0,black)
e.display_frame(buf,None)
The result
Update:
I'm using MicroPython v1.16 on 2021-06-18; ESP32 module with ESP32.
Please note that I did file a new issue in the mcauser/micropython-waveshare-epaper repository.
Don't know anything about your Espressif ESP32-PICO-KIT, but the v4 datasheet says: "USB-UART bridge Single-chip USB-UART bridge: CP2102 in V4 provides up to 1 Mbps transfer rates and CP2102N in V4.1 offers up to 3 Mbps transfers rates."
The 20,000,000 value you have in SoftSPI looks VERY suspicious. Did you mean 2,000,000?
Edit: I just realied this isn't using USB-UART, rather SDIO/SPI. So, those rate limits above aren't relevant.

SOLVED - Debug Darkice to understand why is not connecting to shoutcast

I'm trying to connect to a shoutcast server from a darkice client using Ubuntu. This is my configuration:
#this section describes general aspects of the live streaming session
[general]
duration = 0 # duration of encoding, in seconds. 0 means forever
bufferSecs = 10 # size of internal slip buffer, in seconds
reconnect = yes # reconnect to the server(s) if disconnected
realtime = no # run the encoder with POSIX realtime priority
rtprio = 3 # scheduling priority for the realtime threads
# this section describes the audio input that will be streamed
[input]
device = hw:CARD=PCH,DEV=0
sampleRate = 44100 # sample rate in Hz. try 11025, 22050 or 44100
bitsPerSample = 16 # bits per sample. try 16
channel = 2 # channels. 1 = mono, 2 = stereo
# this section describes a streaming connection to an IceCast2 server
# there may be up to 8 of these sections, named [icecast2-0] ... [icecast2-7]
# these can be mixed with [icecast-x] and [shoutcast-x] sections
[shoutcast-0]
bitrateMode = cbr
format = mp3
bitrate = 96
quality = 1.0
server = xxxxxxxxxxxxxxx
port = 8020
password = xxxxxxxxxxxxxxx
name = Radio website
url = https://www.mywebsite.it
genre = live
public = no
But when I run
darkice -v 10 -c /etc/darkice-shoutcast.cfg
It only shows this, without errors or similar, but there is no streaming at the url. Using BUTT it works. I've also tested with 8021 instead of 8020 for port (8020 it's the port number given by the provider) but no luck.
DarkIce 1.4 live audio streamer, http://code.google.com/p/darkice/
Copyright (c) 2000-2007, Tyrell Hungary, http://tyrell.hu/
Copyright (c) 2008-2013, Akos Maroy and Rafael Diniz
This is free software, and you are welcome to redistribute it
under the terms of The GNU General Public License version 3 or
any later version.
Using config file: /etc/darkice-shoutcast.cfg
18-May-2021 12:02:28 Using ALSA DSP input device: hw:CARD=PCH,DEV=0
18-May-2021 12:02:28 buffer size: 1764000
18-May-2021 12:02:28 encoding
18-May-2021 12:02:28 MultiThreadedConnector :: transfer, bytes 0
18-May-2021 12:02:28 MultiThreadedConnector :: ThreadData :: threadFunction, was (thread, priority, type): 0x5568a502c010 0 SCHED_OTHER
18-May-2021 12:02:28 MultiThreadedConnector :: ThreadData :: threadFunction, now is (thread, priority, type): 0x5568a502c010 0 SCHED_OTHER
ADDENDUM
I've used tcpdump to understand what could be and I just see something similar to "invalid password"
: Flags [P.], cksum 0xc379 (correct), seq 1:19, ack 3090, win 294, options [nop,nop,TS val 3348978428 ecr 531576376], length 18
E..F1O#.1.3'.}.......T.Jq.k.D......&.y.....
..Z...68Invalid Passwor
Suggestions on how to better debug or fix this?
SOLVED
It seems the error is related to the password and wrong parsing of the config file, so I've written it without spaces
[shoutcast-0]
bitrateMode = cbr
format = mp3
bitrate = 96
quality = 1.0
server = xxxxxxxxxxxxxxx
port = 8020
password=xxxxxxxxxxxxxxx
name = Radio website
url = https://www.mywebsite.it
genre = live
public = no

Setting up Sphinx Search

I've been looking for tutorials online to setup sphinx search, and I have got the test database working. However I am having trouble getting my own database to work.
sphinx.conf
source src1
{
type = mysql
sql_host = localhost
sql_user = root
sql_pass = MyPassword
sql_db = MyDatabase
sql_port = 3306
sql_query = \
SELECT listing_id, title, description, image_id \
FROM listings
sql_attr_uint = listing_id
sql_query_info = SELECT listing_id, title, description, image_id FROM listings
}
index test1
{
source = src1
path = /var/lib/sphinxsearch/data/test1
docinfo = extern
charset_type = sbcs
}
searchd
{
listen = 9312
log = /var/log/sphinxsearch/searchd.log
However when I try and run:
sudo indexer --all --rotate
The output in putty is:
using config file '/etc/sphinxsearch/sphinx.conf'...
indexing index 'test1'...
WARNING: attribute 'listing_id' not found - IGNORING
WARNING: Attribute count is 0: switching to none docinfo
WARNING: collect_hits: mem_limit=0 kb too low, increasing to 24576 kb
collected 3 docs, 0.0 MB
sorted 0.0 Mhits, 100.0% done
total 3 docs, 49 bytes
total 0.002 sec, 16740 bytes/sec, 1024.94 docs/sec
total 2 reads, 0.000 sec, 0.0 kb/call avg, 0.0 msec/call avg
total 6 writes, 0.000 sec, 0.0 kb/call avg, 0.0 msec/call avg
rotating indices: succesfully sent SIGHUP to searchd (pid=911)
However, when I try and run "search df" for example, I get:
Sphinx 2.0.4-id64-release (r3135)
Copyright (c) 2001-2012, Andrew Aksyonoff
Copyright (c) 2008-2012, Sphinx Technologies Inc (http://sphinxsearch.com)
using config file '/etc/sphinxsearch/sphinx.conf'...
FATAL: 'sql_query_info' value must contain '$id'
I am running Sphinx Search on Ubuntu 14.04 using an account called "user" which is part of the sudoers file.
I have lost my mind with this, so would appreciate someones help.
Thanks
Your sql_query_info is invalid. It needs to contain $id, as the message says.
However, would highly recommend not using search tool - its broken. Skip it. (articles recommending its use, are outdated) - sql_query_info is only used by search.
Move right on to starting searchd, and use test.php if dont have an application yet. Using test.php to test your index is MUCH better.

Resources