ffmpeg提供# -*- coding: utf-8 -*-
SOURCE_MARKUP = """
<root>
<data name="S_LANGUAGE_ENF_IE" xml:space="preserve">
<value>English</value>
<comment>Language English (Ireland)</comment>
</data>
<data name="S_LANGUAGE_GER" xml:space="preserve">
<value>German</value>
<comment>Language German</comment>
</data>
<data name="S_LANGUAGE_FRA" xml:space="preserve">
<value>French</value>
<comment>language French</comment>
</data>
<data name="S_LANGUAGE_NED" xml:space="preserve">
<value>Dutch</value>
<comment>Language Dutch</comment>
</data>
<data name="S_LANGUAGE_SPA" xml:space="preserve">
<value>Spanish</value>
<comment>Language Spanish</comment>
</data>
</root>
"""
DELTA_MARKUP = """
<root>
<data name="S_LANGUAGE_FRA" xml:space="preserve">
<value>Français</value>
<comment>language French</comment>
</data>
<data name="S_LANGUAGE_NED" xml:space="preserve">
<value>Néerlandais</value>
<comment>Language Dutch</comment>
</data>
</root>
"""
from bs4 import BeautifulSoup
source = BeautifulSoup(SOURCE_MARKUP)
delta = BeautifulSoup(DELTA_MARKUP)
delta_data = delta.find_all('data', attrs={'name': True})
for change in delta_data:
# find in source
origin = source.find('data', attrs={'name': change['name']})
# replace tag
origin.replace_with(change)
print source.prettify()
选项,因此您可以根据流的质量选择程序或流。但是,如果您已经知道哪个程序对应于所需的宽度,那么它很有用。
如果我不知道哪个节目或流号的宽度为640和高度为360,我如何告诉ffmpeg选择具有640x360的节目或流,因为它默认选择最佳流。