I'm trying to pass metadata tags that I generated with code.
import ffmpeg
tags = {'metadata:g:0':"artist=various artists", 'metadata:g:1':"title=title" , 'metadata:g:2':"network=network", 'metadata:g:3':"show=show",'metadata:g:4':"description=description" ,'metadata:g:5':"genre=genre", 'metadata:g:6':"MediaCreateDate=2015:07:09 00:00:00Z"}
process = (
ffmpeg
.input('input.mp4')
.output('output.mp4', codec='copy', map_metadata='0', **{tags})
.run()
)
I get this error:
.output('output.mp4', codec='copy', map_metadata='0', **{tags}) TypeError: unhashable type: 'dict'
I try to pass it not as variable, it works:
process = (
ffmpeg
.input('input.mp4')
.output('output.mp4', codec='copy', map_metadata='0', **{'metadata:g:0':"artist=various artists", 'metadata:g:1':"title=title" , 'metadata:g:2':"network=network", 'metadata:g:3':"show=show",'metadata:g:4':"description=description" ,'metadata:g:5':"genre=genre", 'metadata:g:6':"MediaCreateDate=2015:07:09 00:00:00Z"})
.run()
)
What I'm doing wrong?
and with:
import ffmpeg
tags = {'metadata:g:0':"artist=various artists", 'metadata:g:1':"title=title" , 'metadata:g:2':"network=network", 'metadata:g:3':"show=show",'metadata:g:4':"description=description" ,'metadata:g:5':"genre=genre", 'metadata:g:6':"MediaCreateDate=2015:07:09 00:00:00Z"}
process = (
ffmpeg
.input('input.mp4')
.output('output.mp4', codec='copy', map_metadata='0', **tags)
.run()
)
It's OK?
x = { "a":1, "b": 2 }
def SuperTest(**kwargs):
print(kwargs)
SuperTest(**x) # OK
SuperTest(**{x}) # Error
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.