Android Sound, no picture (ERROR: DVDVideoCodecAmlogic: Failed to open Amlogic Codec)
#1
Bug 
Hi,

While stock video player plays HD MKV files smooth as butter, XBMC without AMCODEC is unable to play an MKV fluently. With AMCODEC enabled => black screen of curse.

I have read all the forum back and forth, and I haven't found any clue on how to fix my issue:

- I have an Amlogic AML8726-MX box, cheap generic, china brand, no support... "Ask vendor for a new firmware" is not a valid answer
- I have tested several ROMs with no success, current one is the one at http://w2comp.com/itm/700685/74585/hd-me...atid=51474 (stock Amlogic ROM 4.2.2 rooted)
- I have tested XBMC from 13.0 to 13.2 beta1 [UPDATED 2015.02.15: tested up to Kodi 14.1]
- I have given root privileges to XBMC
- I have set right permissions to right files (chmod 666 /dev/am*), and made those permissions persist trough a boot script. I have verified the permissions are right at every boot.
- Then I open XBMC, and it does its magic with some other files permissions. Enable AMCODEC at video->acceleration and... I get the same as many of us: sound is there but you are still at the XBMC UI. You can force to bring the video intent to front, but you only get a black screen.

Once checked the log file, there comes that f*cking line with every try:

ERROR: DVDVideoCodecAmlogic: Failed to open Amlogic Codec

So, if anybody could help me/us to find a cure for this issue, I am available for testing, reporting, debugging...

PS: I have even edited init.amlogic.rc to fix the permissions to each and every file needed by XBMC, but this file looks to get regenerated at each boot, so there is no effect in editing it. Anyway, mabye anybody finds a clue in it (original file in the ROM):

Code:
import init.amlogic.usb.rc
import init.amlogic.board.rc

on early-init
    mount debugfs debugfs /sys/kernel/debug
    mount usbfs none /proc/bus/usb

    symlink /initlogo.720p.rle /initlogo.rle
    insmod /boot/ump.ko ump_debug_level=2
    insmod /boot/mali.ko mali_debug_level=2

on init
    mkdir /mnt/shell/emulated 0700 shell shell
    mkdir /storage/emulated 0555 root root

    export EXTERNAL_STORAGE /storage/emulated/legacy
    export EMULATED_STORAGE_SOURCE /mnt/shell/emulated
    export EMULATED_STORAGE_TARGET /storage/emulated

    # Support legacy paths
    symlink /storage/emulated/legacy /sdcard
    symlink /storage/emulated/legacy /mnt/sdcard
    symlink /storage/emulated/legacy /storage/sdcard0
    symlink /mnt/shell/emulated/0 /storage/emulated/legacy

    mkdir /storage/external_storage 0666 system system
    mount tmpfs tmpfs /storage/external_storage rec mode=0775,gid=1000

on post-fs-data
    mkdir /data/misc/wifi 0770 wifi wifi
    mkdir /data/misc/wifi/sockets 0770 wifi wifi
    mkdir /data/misc/dhcp 0770 dhcp dhcp
    chown dhcp dhcp /data/misc/dhcp

    mkdir /data/misc/etc 0777 system pppoe
    mkdir /data/misc/etc/ppp 0777 system pppoe
    chown system system /etc/ppp
    chmod 0770 /etc/ppp
    # we will remap this as /storage/sdcard0 with the sdcard fuse tool
    mkdir /data/media 0770 media_rw media_rw
    chown media_rw media_rw /data/media

    # change back to bluetooth from system
    chown bluetooth bluetooth /data/misc/bluetooth

    # Set indication (checked by vold) that we have finished this action
    setprop vold.post_fs_data_done 1

on boot

# Default Read Ahead value for sdcards
    write /sys/block/mmcblk0/queue/read_ahead_kb 2048
    write /sys/block/mmcblk1/queue/read_ahead_kb 2048


    chown media system /sys/class/tsync/pts_video
    chown media system /sys/class/tsync/pts_audio
    chown media system /sys/class/tsync/pts_pcrscr
    chown media system /sys/class/tsync/event
    chown media system /sys/class/tsync/mode
    chown media system /sys/class/tsync/enable
    chown media system /sys/class/tsync/av_threshold_min
    chown media system /sys/class/tsync/av_threshold_max
    chown system system /sys/class/graphics/fb0/blank
    chown media system /sys/class/graphics/fb1/blank
    chown media system /sys/class/graphics/fb0/order
    chown media system /sys/class/graphics/fb1/order
    chown media system /sys/class/graphics/fb0/enable_key
    chown media system /sys/class/graphics/fb0/enable_key_onhold
    chmod 0664 /sys/class/tsync/pts_video
    chmod 0664 /sys/class/tsync/pts_audio
    chmod 0664 /sys/class/tsync/pts_pcrscr
    chmod 0664 /sys/class/tsync/event
    chmod 0664 /sys/class/tsync/mode
    chmod 0664 /sys/class/tsync/av_threshold_min
    chmod 0664 /sys/class/tsync/av_threshold_max
    chmod 0664 /sys/class/tsync/enable
    chmod 0664 /sys/class/graphics/fb0/blank
    chmod 0664 /sys/class/graphics/fb0/order
    chmod 0664 /sys/class/graphics/fb1/blank
    chmod 0664 /sys/class/graphics/fb1/order
    chmod 0664 /sys/class/graphics/fb0/enable_key
    chmod 0664 /sys/class/graphics/fb0/enable_key_onhold

    chown media system /sys/class/video/blackout_policy
    chown media system /sys/class/video/screen_mode
    chown media system /sys/class/video/axis
    chown media system /sys/class/video/disable_video
    chown media system /sys/class/video/zoom
    chown media system /sys/class/ppmgr/angle
    chown media system /sys/class/ppmgr/disp
    chown media system /sys/class/ppmgr/ppscaler
    chown media system /sys/class/ppmgr/ppscaler_rect
    chmod 0664 /sys/class/video/blackout_policy
    chmod 0664 /sys/class/video/screen_mode
    chmod 0664 /sys/class/video/axis
    chmod 0664 /sys/class/video/disable_video
    chmod 0664 /sys/class/video/zoom
    chmod 0664 /sys/class/ppmgr/angle
    chmod 0664 /sys/class/ppmgr/disp
    chmod 0664 /sys/class/ppmgr/ppscaler
    chmod 0664 /sys/class/ppmgr/ppscaler_rect

    chown media system /sys/class/amaudio/audio_channels_mask
    chown media system /sys/class/amaudio/enable_resample
    chown media system /sys/class/amaudio/resample_type
    chmod 0664 /sys/class/amaudio/audio_channels_mask
    chmod 0664 /sys/class/amaudio/enable_resample
    chmod 0664 /sys/class/amaudio/resample_type

    chown system system /sys/class/audiodsp/digital_raw
    chmod 0664 /sys/class/audiodsp/digital_raw
    chmod 0644 /sys/class/audiodsp/ac3_drc_control
    chown system system /sys/class/audiodsp/ac3_drc_control
    chmod 0666  /dev/audiodsp_pcmenc
    chmod 0666  /dev/audio_spdif
    
    chmod 0666 /dev/amstream_sub_read
    chmod 0666 /dev/ilitek_ctrl

    chown system system /sys/class/subtitle/enable
    chown system system /sys/class/subtitle/total
    chown system system /sys/class/subtitle/width
    chown system system /sys/class/subtitle/height
    chown system system /sys/class/subtitle/type
    chown system system /sys/class/subtitle/curr
    chown system system /sys/class/subtitle/size
    chown system system /sys/class/subtitle/data
    chown system system /sys/class/subtitle/startpts
    chown system system /sys/class/subtitle/fps
    chown system system /sys/class/subtitle/subtype
    chown media system /sys/class/audiodsp/codec_fatal_err
    chown media system /sys/class/subtitle/index
    chmod 0664 /sys/class/audiodsp/codec_fatal_err
    chmod 0664 /sys/class/subtitle/enable
    chmod 0664 /sys/class/subtitle/total
    chmod 0664 /sys/class/subtitle/width
    chmod 0664 /sys/class/subtitle/height
    chmod 0664 /sys/class/subtitle/type
    chmod 0664 /sys/class/subtitle/curr
    chmod 0664 /sys/class/subtitle/size
    chmod 0664 /sys/class/subtitle/data
    chmod 0664 /sys/class/subtitle/startpts
    chmod 0664 /sys/class/subtitle/fps
    chmod 0664 /sys/class/subtitle/subtype
    chmod 0664 /sys/class/subtitle/index

    # DVB
    chmod 0666 /dev/dvb0.frontend0
    chmod 0666 /dev/dvb0.demux0
    chmod 0666 /dev/dvb0.demux1
    chmod 0666 /dev/dvb0.demux2
    chmod 0666 /dev/dvb0.dvr0
    chmod 0666 /dev/dvb0.dvr1
    chmod 0666 /dev/dvb0.dvr2
    
    chown media system /sys/class/stb/demux0_source
    chown media system /sys/class/stb/demux1_source
    chown media system /sys/class/stb/demux2_source
    chown media system /sys/class/stb/source
    chown media system /sys/class/stb/asyncfifo0_source
    chown media system /sys/class/stb/asyncfifo1_source
    chown media system /sys/class/stb/asyncfifo0_flush_size
    chown media system /sys/class/stb/asyncfifo1_flush_size
    chown media system /sys/class/stb/video_pts
    chown media system /sys/class/stb/audio_pts
    chown media system /sys/class/stb/dsc_source
    chmod 0664 /sys/class/stb/demux0_source
    chmod 0664 /sys/class/stb/demux1_source
    chmod 0664 /sys/class/stb/demux2_source
    chmod 0664 /sys/class/stb/source
    chmod 0664 /sys/class/stb/asyncfifo0_source
    chmod 0664 /sys/class/stb/asyncfifo1_source
    chmod 0664 /sys/class/stb/asyncfifo0_flush_size
    chmod 0664 /sys/class/stb/asyncfifo1_flush_size
    chmod 0664 /sys/class/stb/video_pts
    chmod 0664 /sys/class/stb/audio_pts
    chmod 0644 /sys/class/stb/dsc_source

    chmod 0666 /dev/ge2d
    chmod 0666 /dev/amaudio_ctl
    chown media system /sys/class/tsync/pcr_recover
    chmod 0664 /sys/class/tsync/pcr_recover

    chown media system /sys/module/amvdec_h264/parameters/dec_control
    chown media system /sys/module/amvdec_mpeg12/parameters/dec_control
    chown media system /sys/module/di/parameters/bypass_hd
    chown media system /sys/module/di/parameters/bypass_all
    chown media system /sys/module/amvideo/parameters/smooth_sync_enable
    chown media system /sys/module/amvdec_h264/parameters/error_recovery_mode
    chmod 0664 /sys/module/amvdec_h264/parameters/dec_control
    chmod 0664 /sys/module/amvdec_mpeg12/parameters/dec_control
    chmod 0664 /sys/module/di/parameters/bypass_hd
    chmod 0664 /sys/module/di/parameters/bypass_all
    chmod 0664 /sys/module/amvideo/parameters/smooth_sync_enable
    chmod 0664 /sys/module/amvdec_h264/parameters/error_recovery_mode

    chown media system /sys/module/deinterlace/parameters/deinterlace_mode
    chmod 0664 /sys/module/deinterlace/parameters/deinterlace_mode
    chown media system /sys/class/graphics/fb0/block_mode
    chmod 0664 /sys/class/graphics/fb0/block_mode

    # HDMI/LCD switch
    chown system system /sys/class/display/mode
    chown media system /sys/class/display/axis
    chown system system /sys/class/graphics/fb0/scale
    chown system system /sys/class/graphics/fb1/scale
    chown system system /sys/class/graphics/fb0/scale_axis
    chown system system /sys/class/graphics/fb1/scale_axis
    chown system system /sys/class/amhdmitx/amhdmitx0/disp_mode
    chown system system /sys/class/amhdmitx/amhdmitx0/config
    chmod 0664 /sys/class/display/mode
    chmod 0664 /sys/class/display/axis
    chmod 0664 /sys/class/graphics/fb0/scale
    chmod 0664 /sys/class/graphics/fb1/scale
    chmod 0664 /sys/class/amhdmitx/amhdmitx0/disp_mode
    chmod 0664 /sys/class/amhdmitx/amhdmitx0/config
    chown media system /sys/class/graphics/fb0/block_mode
    chmod 0664 /sys/class/graphics/fb0/block_mode

    # Dual display
    chown system system /sys/class/display2/mode
    chown system system /sys/class/display2/axis
    chown system system /sys/class/video2/clone
    chown system system /sys/class/vfm/map
    chown system system /sys/module/amvideo2/parameters/clone_frame_scale_width
    chown system system /sys/module/amvideo2/parameters/clone_frame_rate
    chown system system /sys/class/video2/screen_mode
    chown system system /sys/class/video2/zoom
    chmod 0664 /sys/class/display2/mode
    chmod 0664 /sys/class/display2/axis
    chmod 0664 /sys/class/video2/clone
    chmod 0664 /sys/class/vfm/map
    chmod 0664 /sys/module/amvideo2/parameters/clone_frame_scale_width
    chmod 0664 /sys/module/amvideo2/parameters/clone_frame_rate
    chmod 0664 /sys/class/video2/screen_mode
    chmod 0664 /sys/class/video2/zoom

    chown system system /sys/class/graphics/fb2/blank
    chown system system /sys/class/graphics/fb2/clone
    chown system system /sys/class/display2/venc_mux
    chmod 0664 /sys/class/graphics/fb2/blank
    chmod 0664 /sys/class/graphics/fb2/clone
    chmod 0664 /sys/class/display2/venc_mux

    # Free scale
    chown system system /sys/class/graphics/fb0/free_scale
    chown system system /sys/class/graphics/fb0/scale_width
    chown system system /sys/class/graphics/fb0/scale_height
    chown system system /sys/class/graphics/fb0/free_scale_axis
    chown system system /sys/class/graphics/fb1/free_scale
    chown system system /sys/class/graphics/fb1/scale_width
    chown system system /sys/class/graphics/fb1/scale_height
    chown media system /sys/class/graphics/fb0/request2XScale
    chmod 0664 /sys/class/graphics/fb0/free_scale
    chmod 0664 /sys/class/graphics/fb0/scale_width
    chmod 0664 /sys/class/graphics/fb0/scale_height
    chmod 0664 /sys/class/graphics/fb0/free_scale_axis
    chmod 0664 /sys/class/graphics/fb1/free_scale
    chmod 0664 /sys/class/graphics/fb1/scale_width
    chmod 0664 /sys/class/graphics/fb1/scale_height
    chmod 0664 /sys/class/graphics/fb0/request2XScale


    # CPU scaling
    chown system system /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
    chown system system /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
    chown system system /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
    chown system system /sys/devices/system/cpu/cpufreq/conservative/freq_step

    chown system system /sys/devices/system/cpu/cpufreq/performance2/sampling_rate
    chown system system /sys/devices/system/cpu/cpufreq/performance2/down_threshold
    chown system system /sys/devices/system/cpu/cpufreq/performance2/up_threshold
    chown system system /sys/devices/system/cpu/cpufreq/conservative/sampling_rate
    chown system system /sys/devices/system/cpu/cpufreq/conservative/down_threshold
    chown system system /sys/devices/system/cpu/cpufreq/conservative/up_threshold
    chown system system /sys/class/mali_freq/max
    chown system system /sys/class/freq_limit/limit
    chown system system /sys/devices/system/cpu/cpu1/online

    chmod 664 /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
    chmod 664 /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
    chmod 664 /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
    chmod 664 /sys/devices/system/cpu/cpufreq/conservative/freq_step
    chmod 664 /sys/devices/system/cpu/cpufreq/performance2/sampling_rate
    chmod 664 /sys/devices/system/cpu/cpufreq/performance2/down_threshold
    chmod 664 /sys/devices/system/cpu/cpufreq/performance2/up_threshold
    chmod 664 /sys/devices/system/cpu/cpufreq/conservative/sampling_rate
    chmod 664 /sys/devices/system/cpu/cpufreq/conservative/down_threshold
    chmod 664 /sys/devices/system/cpu/cpufreq/conservative/up_threshold
    chmod 664 /sys/class/mali_freq/max
    chmod 664 /sys/class/freq_limit/limit
    chmod 664 /sys/devices/system/cpu/cpu1/online


    chown system system /sys/devices/system/clocksource/clocksource0/current_clocksource
    # usbpm
    chown system system /sys/devices/lm0/peri_power
    chown system system /sys/devices/lm0/peri_sleepm
    chown system system /sys/devices/lm0/peri_otg_disable
    chown system system /sys/devices/lm1/peri_sleepm
    chown system system /sys/devices/lm1/peri_otg_disable
    chown system system /sys/class/aml_mod/mod_off
    chown system system /sys/class/aml_mod/mod_on

    start sdcard
    mkdir /data/media/0/external_storage 0000 system system


service display /system/bin/set_display_mode.sh panel
    class core
    oneshot

service dhcpcd_wlan0 /system/bin/dhcpcd -ABKL
    class main
    disabled
    oneshot

service dhcpcd_p2p /system/bin/dhcpcd -aABKL
    class main
    disabled
    oneshot

service dhcpcd_eth0 /system/bin/dhcpcd -ABKL -f/system/etc/dhcpcd/dhcpcd.conf
    class main
    disabled
    oneshot

service dhcpcd_usbnet0 /system/bin/dhcpcd -d -f /system/etc/dhcpcd/dhcpcd.conf -B
    class main
    group dhcp system
    disabled
    oneshot
    
service smbd /system/bin/smbd
    class main
    group system system
    oneshot
    
service iprenew_wlan0 /system/bin/dhcpcd -n
    class main
    disabled
    oneshot

service iprenew_p2p /system/bin/dhcpcd -n
    class main
    disabled
    oneshot

service iprenew_eth0 /system/bin/dhcpcd -n
    class main
    disabled
    oneshot

service smbd /system/bin/smbd
    class main
    group system system
    oneshot
    
# remote
service remotecfg /system/bin/remotecfg /system/etc/remote.conf
    class main
    oneshot
    
service ril-daemon /system/bin/rild -l /system/lib/libaml-ril.so
  socket rild stream 660 root radio
  socket rild-debug stream 660 radio system
  user root
  group radio cache inet misc audio system
  disabled

service pppd_gprs /system/bin/init-pppd.sh
  user root
  group radio net_admin cache inet misc system
  disabled
  oneshot

service pppoe_wrapper /system/bin/pppoe_wrapper
  class main
  group system inet
  oneshot

# virtual sdcard daemon running as media_rw (1023)
service sdcard /system/bin/sdcard /data/media /mnt/shell/emulated 1023 1023
    class late_start

on property:hw.nophone=true
  stop ril-daemon

on property:hw.nophone=false
  start ril-daemon
Reply
#2
Can you post your debug log as well? It could be something unrelated to the AMLogic permissions issue.
Reply
#3
you missed /dev/am*

Also, doing a double chown is silly, change it once to what you need. You don't have to do it twice, it just makes reading the code confusing.
Reply
#4
@MeatGrinder
The .rc file is the one in the system, not mine. The modified one got overwritten at each boot. I use SManager to run my own script as root:
Code:
chmod 666 /dev/am*

@NedScott My very last log. Fresh start with amcodec and debug enabled, open movie file, black screen, stop...
http://xbmclogs.com/show.php?id=255605
Reply
#5
Did you try the Matricom MX2 1.1.9 firmware? That firmware is not bad, 1.1.10 or 1.2.0 will be released this week, which will be significantly improved.
My XBMC / Kodi history.
XBMC for XBOX -> XBMC for Windows -> XBMC for Android -> Kodi for Android - > Kodi v16 OE (Amlogic) -> Kodi v17 LE (NUC 2x) -> Kodi v18.5 LE (NUC 2x)
Reply
#6
Matricom ROM file has a hardware check, and I couldn't test it. And my current ROM has anything I want, and "stock" XBMC that I like most.

Anyway, it looks like the black screen issue with amcodec is caused somewhere else and could be fixed somehow. Maybe witthin XBMC, maybe not. I just want to help find a fix for this issue that affects several users in this forum.

The old advice of fixing permissions for /dev/am* seems to work only for a few users. Maybe we should look into anywhere else.

I have not enough knowledge about XBMC and its relationship with amecodec to look for a fix by my own. Anyway, I have downloaded the sources and played a bit, had no time for debugging just diving upstream. No success. The message is generated at

https://github.com/xbmc/xbmc/blob/master...c.cpp#L227

And looks like everything is right but the call to OpenDecoder(), defined at

https://github.com/xbmc/xbmc/blob/master....cpp#L1427

Seems to fail with codec_init() call at

https://github.com/xbmc/xbmc/blob/master....cpp#L1628


...and then I drowned



-
Reply
#7
Still searching. Nothing new. Sad
Reply
#8
You need to extract, unpack boot.img and change permissions on init.amlogic.rc, Rebuild and flash boot.img in you device again, But this is hard, For easy guide try this in my post:

http://forum.xbmc.org/showthread.php?tid...pid1765306
Reply
#9
I already use the SManager method to fix the permissions, as I said in the first post, but no success.

I have checked that every file has the right permission before launching XBMC, and they are right but the issue is there...
Reply
#10
Tried to add every permission to boot script:

Code:
#!/system/bin/sh
chmod 666 /dev/am*
chmod 666 /sys/class/video/axis
chmod 666 /sys/class/video/screen_mode
chmod 666 /sys/class/video/disable_video
chmod 666 /sys/class/tsync/pts_pcrscr
chmod 666 /sys/class/audiodsp/digital_raw
chmod 666 /sys/class/ppmgr/ppmgr_3d_mode
chmod 666 /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
chmod 666 /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
chmod 666 /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

But no difference, with amcodec enabled -> sound, no picture
Reply
#11
logcat might have more info.
Reply
#12
(2014-08-06, 02:01)MeatGrinder Wrote: logcat might have more info.
Should, but doesn't Sad
Reply
#13
your box is broke then, contact your box vendor.
Reply
#14
I have a feeling I bought the same box (or very similar).
I contacted the seller (on ebay) about this and he said he'll give me 12USD refund which is ridiculous, I think people really to be careful from where to buy these type of boxes.

Either the sellers know they're broken, or there's simply way too many (fake) broken boxes out there.
Reply
#15
First:
(2014-07-25, 20:30)Beltxo Wrote: ...
While stock video player plays HD MKV files smooth as butter, XBMC without AMCODEC is unable to play an MKV fluently. With AMCODEC enabled => black screen of curse.
...
Second:
(2014-07-25, 20:30)Beltxo Wrote: ...
- I have an Amlogic AML8726-MX box, cheap generic, china brand, no support... "Ask vendor for a new firmware" is not a valid answer
...
Reply

Logout Mark Read Team Forum Stats Members Help
Sound, no picture (ERROR: DVDVideoCodecAmlogic: Failed to open Amlogic Codec)1