transcoding video

197 views
Skip to first unread message

TT

unread,
Dec 22, 2015, 8:06:02 AM12/22/15
to amp...@googlegroups.com
Hello,
first of all thanks for keeping ampache alive.
it works well on all my devices - both audio and video - my android kitkat phone uses Dsub as a client.

the only problem i have is with certain video streams.
it seems to be a problem with ac3 audio.
on my android device, it (Dsub + MXPlayer) plays video but not audio.
on my home machine (arch linux, iceweasel 42) it doesn't play at all (Unsupported).
i can copy the affected videos to my phone's sd card, and they play ok.

I thought it might help to transcode videos on the fly.
i tried all sorts of settings, but it looks like transcoding audio only (e.g. flac => ogg) works ok, but transcoding video never works.

i tried the transcode commands on the server (debian stable, i use avconv) to a file, and i can play that file.
i tried the transcode commands on my desktop (archlinux, uses ffmpeg) and i can even pipe the output to mpv.
this last option, however, only works for avi, and the resulting video seems to be missing some metadata/headers.

the logs don't show any errors, avconv is getting busy on request and stops again when i stop the video or close the client.
the error seems to occur elsewhere.

my thoughts:
it seems that some formats are not suitable for streaming, or at least they work locally but not remotely. ac3 audio seems to be the culprit.
do i have to choose a transcode format that will work over the web? i think i tried all the presets in the config file.
the server is an old laptop, maybe it can't handle the processing. i tried to transcode only the audio to mp3. this works manually and is _much_ easier on resources, but doesn't influence the problem.

i spent days researching this, i think i did all the troubleshooting and have all the information needed, but no solution.

any thoughts?

log excerpt on transcoding to avi, requested by Dsub on android kitkat phone.
transcoding: video stream copy, audio from ac3 to mp3:

2015-12-22 15:01:43 [sub-andro] (media) -> Using default target format
2015-12-22 15:01:43 [sub-andro] (media) -> Transcode settings: from mkv to avi
2015-12-22 15:01:43 [sub-andro] (media) -> Command: avconv Arguments: -i %FILE% -c:a libmp3lame -f avi -c:v copy pipe:1
2015-12-22 15:01:43 [sub-andro] (media) -> Changing play url type from {mkv} to {avi} due to encoding settings...
2015-12-22 15:01:43 [sub-andro] (session) -> Session created: 96061698db6e38e7281d384abd37bcff
2015-12-22 15:01:43 [sub-andro] (subsonic) -> Stream proxy: http://89.27.2.34:8888/play/ssid/96061698db6e38e7281d384abd37bcff/type/video/oid/1/uid/4/client/DSub/noscrobble/1/transcode_to/avi/player/api/name/Better%20Call%20Saul%20S01E06%20%20%20%20MRSK.avi
2015-12-22 15:01:43 [ampache] (play) -> Asked for type {video}
2015-12-22 15:01:43 [sub-andro] (session) -> 96061698db6e38e7281d384abd37bcff has been extended to Tue, 22 Dec 2015 17:01:43 +0200 extension length 7200
2015-12-22 15:01:43 [sub-andro] (User Ip) -> Login from ip adress: 89.27.2.34
2015-12-22 15:01:43 [sub-andro] (play) -> Playing file (/home/mus/media/video/Better.Call.Saul.S01.Season.1.Complete.720p.HDTV.x264-MRSK[cttv]/Better.Call.Saul.S01E06.720p.HDTV.X264-MRSK.mkv}...
2015-12-22 15:01:43 [sub-andro] (play) -> Media type {mkv}
2015-12-22 15:01:43 [sub-andro] (play) -> Custom play action {}
2015-12-22 15:01:43 [sub-andro] (play) -> Transcode to {avi}
2015-12-22 15:01:43 [sub-andro] (play) -> Transcoding due to explicit request for avi
2015-12-22 15:01:43 [sub-andro] (stream.class.php) -> Starting transcode for {/home/mus/media/video/Better.Call.Saul.S01.Season.1.Complete.720p.HDTV.x264-MRSK[cttv]/Better.Call.Saul.S01E06.720p.HDTV.X264-MRSK.mkv}. Type {avi}. Options: Array
2015-12-22 15:01:43 [sub-andro] (stream.class.php) -> (
2015-12-22 15:01:43 [sub-andro] (stream.class.php) -> )
2015-12-22 15:01:43 [sub-andro] (stream.class.php) -> }...
2015-12-22 15:01:43 [sub-andro] (media) -> Explicit format request {avi}
2015-12-22 15:01:43 [sub-andro] (media) -> Transcode settings: from mkv to avi
2015-12-22 15:01:43 [sub-andro] (media) -> Command: avconv Arguments: -i %FILE% -c:a libmp3lame -f avi -c:v copy pipe:1
2015-12-22 15:01:43 [sub-andro] (stream) -> Configured bitrate is 4096
2015-12-22 15:01:43 [sub-andro] (stream) -> Final transcode bitrate is 4096
2015-12-22 15:01:43 [sub-andro] (stream) -> %SAMPLE% not in transcode command
2015-12-22 15:01:43 [sub-andro] (stream) -> %BITRATE% not in transcode command
2015-12-22 15:01:43 [sub-andro] (stream) -> %MAXBITRATE% not in transcode command
2015-12-22 15:01:43 [sub-andro] (stream) -> %RESOLUTION% not in transcode command
2015-12-22 15:01:43 [sub-andro] (stream) -> %QUALITY% not in transcode command
2015-12-22 15:01:43 [sub-andro] (stream) -> Transcode command: avconv -i '/home/mus/media/video/Better.Call.Saul.S01.Season.1.Complete.720p.HDTV.x264-MRSK[cttv]/Better.Call.Saul.S01E06.720p.HDTV.X264-MRSK.mkv' -c:a libmp3lame -f avi -c:v copy pipe:1
2015-12-22 15:01:43 [sub-andro] (stream) -> Transcode command prefix: exec 
2015-12-22 15:01:43 [sub-andro] (play) -> Starting stream of /home/mus/media/video/Better.Call.Saul.S01.Season.1.Complete.720p.HDTV.x264-MRSK[cttv]/Better.Call.Saul.S01E06.720p.HDTV.X264-MRSK.mkv with size 594232069
2015-12-22 15:01:43 [sub-andro] (play) -> Registering stream stats for {Better Call Saul S01E06    MRSK}...
2015-12-22 15:01:43 [sub-andro] (user.class.php) -> Updating stats for {video/1} {Mozilla/5.0 (Linux; Android 4.4.2; en-US; E39 Build/Acer_AV0K0_E39_1.024.00_EMEA_GEN1) MXPlayer/1.7.40}...
2015-12-22 15:01:43 [sub-andro] (user.class.php) -> Scrobbling explicitly skipped

turk...@gmail.com

unread,
Dec 24, 2015, 2:44:03 PM12/24/15
to Ampache
ok, i think i'm getting closer to the source of the problem.
i started a thread on xda-developers about what i believe to be at the bottom of the no sound problem.
until i have resolved this, i don't know if i need transcoding or other ampache options.

i am quoting the complete thread:

The old situation:
I have a collection of video in different compressed formats on my home server, and i want to access them from my phone.
So far, i have been using sftp for this (several file managers support this, esp. ES File Manager), but either the sftp protocol or ES file manager aren't suitable for streaming, there's too much stuttering and freezing. This is not a bandwidth issue!

Partial solution & new problem:
I use a dedicated media server (ampache) on my home server, and a dedicated client (DSub) on my Acer E700 (aka E39), stock android, rooted, firewalled.
I noticed a problem with video that uses AC3 sound encoding - The video plays fine (even hi-res), i just don't hear any sound.
And it happens only when i stream the video through the network (http?) (*) - the file plays just fine when i copy it to the phone, or use sftp via ES file manager, or download the file through my media server.

I tried this with all media players i have:
  • stock android video player
  • ES media player
  • MX player (with or without custom codec neon.1.7.32.rev1.zip) - it says, when playing files through the media server, that HW+ or SW decoding is not supported, however when i play the same video locally there's no such limitation.
I also tried all video streaming settings inside DSub:
  • Raw
  • HTTP Live Stream (HLS) (this did not work at all)
  • Direct transcode (requires video -> mp4 or similar setup on server)
  • Flash plugin (did not work, i guess i don't have the flash plugin)
and the result is always the same: all video plays fine, but video with ac3 sound has no sound.
unfortunately most hdtv videos use h264/ac3...

here's a list of codec combinations and resolutions that don't play sound:
  • h264/ac3 1280x720
  • avi/ac3 704x396
  • avi/ac3 640x368
here's a list of codec combinations and resolutions that do play sound:
  • quicktime/mp4 848x448
  • quicktime/mp4 1280x720
  • quicktime/mp4 716x404
  • avi/mp3 640x360
I can only come to the conclusion that android treats different codecs differently when streamed through the network. How can I solve this?

(*) i also copied one of the affected files to the public html section and tried to open it through my phone's browser, and the result is the same: no sound with ac3.
i did notice that one of the "good" files opened right inside the browser, whereas the "bad" file asked to open with a media player.

Reply all
Reply to author
Forward
0 new messages