简体   繁体   中英

Why is my .mp4 file not saved after converting?

I wrote a python3 script to communicate with my Raspberry Pi by sending telegram messages. Because my Pi is only able to take h.264 videos that i can't open on my mobile phone I would like to convert them into.mp4 files. Here's the code I'm referring to:


if command == ‘/video‘:
    name = datetime.datetime.now()
    dateiname = ‘/home/pi/Videos/Wettervideos/%s.h264‘ % name
    dateinameneu = ‘/home/pi/Videos/Wettervideos/%s-konvertiert.mp4‘ % name
    camera.start_recording(dateiname)
    sleep(10)
    camera.stop_recording()
    telegram_bot.sendMessage(chat_id, str(Video wird konvertiert))
    command2 = “MP4Box -add “ + dateiname + “ -new “ + dateinameneu
    call ([command2], shell=True)
    telegram_bot.sendMessage(chat_id, str(Video ist fertig konvertiert))
    telegram_bot.sendVideo(chat_id, video=open(dateinameneu,“rb“))

The message „Video ist fertig konvertiert“ is sent, but the.mp4 is not created. Neither in the right nor another folder it can be found. Thanks!

I just solved the problem. The.mp4 file couldn't be created because of the colons in the file name. (Datetime.datetime.now() separates hours, minutes and seconds with colons). Thanks for your comments.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM