Gerbera 将 *.avi 视频转码为 h264 mkv 吗?

Gerbera 将 *.avi 视频转码为 h264 mkv 吗?

我购买了一台不支持 DIVX/XVID 编解码器的三星智能电视,因此我拥有的任何旧 *.avi 文件都可以使用。

虽然我总是可以转换它们,但我的 DLNA 网络中还有其他支持它们的设备,所以我认为快速转换是更好的选择。

config.xml我正在尝试在(相关部分)中设置如下的转码和文件类型:

<mappings>
    <extension-mimetype ignore-unknown="no">
        <map from="mp3" to="audio/mpeg"/>
        <map from="ogx" to="application/ogg"/>
        <map from="ogv" to="video/ogg"/>
        <map from="oga" to="audio/ogg"/>
        <map from="ogg" to="audio/ogg"/>
        <map from="ogm" to="video/ogg"/>
        <map from="asf" to="video/x-ms-asf"/>
        <map from="asx" to="video/x-ms-asf"/>
        <map from="wma" to="audio/x-ms-wma"/>
        <map from="wax" to="audio/x-ms-wax"/>
        <map from="wmv" to="video/x-ms-wmv"/>
        <map from="wvx" to="video/x-ms-wvx"/>
        <map from="wm" to="video/x-ms-wm"/>
        <map from="wmx" to="video/x-ms-wmx"/>
        <map from="m3u" to="audio/x-mpegurl"/>
        <map from="pls" to="audio/x-scpls"/>
        <map from="flv" to="video/x-flv"/>
        <map from="mkv" to="video/x-matroska"/>
        <map from="mka" to="audio/x-matroska"/>
        <map from="dsf" to="audio/x-dsd"/>
        <map from="dff" to="audio/x-dsd"/>
        <map from="wv" to="audio/x-wavpack"/>
        <map from="avi" to="video/divx"/>
    </extension-mimetype>
    <mimetype-upnpclass>
        <map from="audio/*" to="object.item.audioItem.musicTrack"/>
        <map from="video/*" to="object.item.videoItem"/>
        <map from="image/*" to="object.item.imageItem"/>
        <map from="application/ogg" to="object.item.audioItem.musicTrack"/>
    </mimetype-upnpclass>
    <mimetype-contenttype>
        <treat mimetype="audio/mpeg" as="mp3"/>
        <treat mimetype="application/ogg" as="ogg"/>
        <treat mimetype="audio/ogg" as="ogg"/>
        <treat mimetype="audio/x-flac" as="flac"/>
        <treat mimetype="audio/flac" as="flac"/>
        <treat mimetype="audio/x-ms-wma" as="wma"/>
        <treat mimetype="audio/x-wavpack" as="wv"/>
        <treat mimetype="image/jpeg" as="jpg"/>
        <treat mimetype="audio/x-mpegurl" as="playlist"/>
        <treat mimetype="audio/x-scpls" as="playlist"/>
        <treat mimetype="audio/x-wav" as="pcm"/>
        <treat mimetype="audio/L16" as="pcm"/>
        <treat mimetype="video/x-msvideo" as="avi"/>
        <treat mimetype="video/mp4" as="mp4"/>
        <treat mimetype="audio/mp4" as="mp4"/>
        <treat mimetype="video/x-matroska" as="mkv"/>
        <treat mimetype="audio/x-matroska" as="mka"/>
        <treat mimetype="audio/x-dsd" as="dsd"/>
    </mimetype-contenttype>
</mappings>
<transcoding enabled="yes">
    <mimetype-profile-mappings>
        <transcode mimetype="video/divx" using="ffmpegavi2h264"/>
    </mimetype-profile-mappings>
    <profiles>
        <profile name="ffmpegavi2h264" enabled="yes" type="external">
            <mimetype>video/x-matroska</mimetype>
            <accept-url>no</accept-url>
            <first-resource>yes</first-resource>
            <agent command="ffmpeg" arguments="-y -i %in -c:v libx264 -preset fast -c:a copy %out"/>
            <buffer size="4194304" chunk-size="524288" fill-size="1048576"/>
        </profile>
    </profiles>
</transcoding>

当我选择一个 avi 文件时,我可以看到 ffmpeg 启动了,但电视说它不是一个有效的播放文件。

我错过了什么?

谢谢,因为我不知道还能尝试什么

答案1

您应该添加输出格式选项- -f avi(强制格式),即

...
<profile name="ffmpegavi2h264" enabled="yes" type="external">
    <mimetype>video/x-matroska</mimetype>
    <accept-url>no</accept-url>
    <first-resource>yes</first-resource>
    <agent command="ffmpeg" arguments="-y -i %in -c:v libx264 -preset fast -c:a copy -f avi %out"/>
    <buffer size="4194304" chunk-size="524288" fill-size="1048576"/>
</profile>
...

Gerbera%out替换临时文件时没有扩展名,因此 ffmpeg 产生错误 -Unable to find a suitable output format without extension

相关内容