Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
MP4 decoder
#1
I want to read the video and audio information from mp4 file format.If possible I want to run under python 2.7.I have searched but couldn`t find any
Reply
#2
personally i would just grab the output from programs such as mplayer or similar. There might be some python exclusive packages for similar but can vouch for them.

metulburr@ubuntu:/media/metulburr/4TB HDD/1 Movies$ mplayer -vo null -ao null -identify -frames 0 Almost\ Famous.mp4 
Creating config file: /home/metulburr/.mplayer/config
MPlayer 1.2.1 (Debian), built with gcc-5.3.1 (C) 2000-2016 MPlayer Team
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.

Playing Almost Famous.mp4.
libavformat version 56.40.101 (external)
libavformat file format detected.
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fb3fc396d80]Protocol name not provided, cannot determine if input is local or a network protocol, buffers and access patterns cannot be configured optimally without knowing the protocol
ID_VIDEO_ID=0
[lavf] stream 0: video (h264), -vid 0
ID_AUDIO_ID=0
[lavf] stream 1: audio (aac), -aid 0, -alang und
VIDEO:  [H264]  640x368  24bpp  23.976 fps  625.3 kbps (76.3 kbyte/s)
Clip info:
 major_brand: mp42
ID_CLIP_INFO_NAME0=major_brand
ID_CLIP_INFO_VALUE0=mp42
 minor_version: 0
ID_CLIP_INFO_NAME1=minor_version
ID_CLIP_INFO_VALUE1=0
 compatible_brands: mp42isomavc1
ID_CLIP_INFO_NAME2=compatible_brands
ID_CLIP_INFO_VALUE2=mp42isomavc1
 creation_time: 2010-06-30 22:40:07
ID_CLIP_INFO_NAME3=creation_time
ID_CLIP_INFO_VALUE3=2010-06-30 22:40:07
 encoder: HandBrake 0.9.4 2009112300
ID_CLIP_INFO_NAME4=encoder
ID_CLIP_INFO_VALUE4=HandBrake 0.9.4 2009112300
ID_CLIP_INFO_N=5
Load subtitles in ./
ID_FILENAME=Almost Famous.mp4
ID_DEMUXER=lavfpref
ID_VIDEO_FORMAT=H264
ID_VIDEO_BITRATE=625288
ID_VIDEO_WIDTH=640
ID_VIDEO_HEIGHT=368
ID_VIDEO_FPS=23.976
ID_VIDEO_ASPECT=0.0000
ID_AUDIO_FORMAT=MP4A
ID_AUDIO_BITRATE=159936
ID_AUDIO_RATE=48000
ID_AUDIO_NCH=2
ID_START_TIME=0.00
ID_LENGTH=7392.49
ID_SEEKABLE=1
ID_CHAPTERS=0
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
libavcodec version 56.60.100 (external)
Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
==========================================================================
ID_VIDEO_CODEC=ffh264
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 48000 Hz, 2 ch, floatle, 159.9 kbit/5.21% (ratio: 19992->384000)
ID_AUDIO_BITRATE=159936
ID_AUDIO_RATE=48000
ID_AUDIO_NCH=2
Selected audio codec: [ffaac] afm: ffmpeg (FFmpeg AAC (MPEG-2/MPEG-4 Audio))
==========================================================================
AO: [null] 48000Hz 2ch floatle (4 bytes per sample)
ID_AUDIO_CODEC=ffaac
Starting playback...


Exiting... (End of file)
ID_EXIT=EOF
Recommended Tutorials:
Reply
#3
(Jan-13-2018, 09:19 PM)metulburr Wrote: personally i would just grab the output from programs such as mplayer or similar. There might be some python exclusive packages for similar but can vouch for them.

metulburr@ubuntu:/media/metulburr/4TB HDD/1 Movies$ mplayer -vo null -ao null -identify -frames 0 Almost\ Famous.mp4 
Creating config file: /home/metulburr/.mplayer/config
MPlayer 1.2.1 (Debian), built with gcc-5.3.1 (C) 2000-2016 MPlayer Team
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.

Playing Almost Famous.mp4.
libavformat version 56.40.101 (external)
libavformat file format detected.
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fb3fc396d80]Protocol name not provided, cannot determine if input is local or a network protocol, buffers and access patterns cannot be configured optimally without knowing the protocol
ID_VIDEO_ID=0
[lavf] stream 0: video (h264), -vid 0
ID_AUDIO_ID=0
[lavf] stream 1: audio (aac), -aid 0, -alang und
VIDEO:  [H264]  640x368  24bpp  23.976 fps  625.3 kbps (76.3 kbyte/s)
Clip info:
 major_brand: mp42
ID_CLIP_INFO_NAME0=major_brand
ID_CLIP_INFO_VALUE0=mp42
 minor_version: 0
ID_CLIP_INFO_NAME1=minor_version
ID_CLIP_INFO_VALUE1=0
 compatible_brands: mp42isomavc1
ID_CLIP_INFO_NAME2=compatible_brands
ID_CLIP_INFO_VALUE2=mp42isomavc1
 creation_time: 2010-06-30 22:40:07
ID_CLIP_INFO_NAME3=creation_time
ID_CLIP_INFO_VALUE3=2010-06-30 22:40:07
 encoder: HandBrake 0.9.4 2009112300
ID_CLIP_INFO_NAME4=encoder
ID_CLIP_INFO_VALUE4=HandBrake 0.9.4 2009112300
ID_CLIP_INFO_N=5
Load subtitles in ./
ID_FILENAME=Almost Famous.mp4
ID_DEMUXER=lavfpref
ID_VIDEO_FORMAT=H264
ID_VIDEO_BITRATE=625288
ID_VIDEO_WIDTH=640
ID_VIDEO_HEIGHT=368
ID_VIDEO_FPS=23.976
ID_VIDEO_ASPECT=0.0000
ID_AUDIO_FORMAT=MP4A
ID_AUDIO_BITRATE=159936
ID_AUDIO_RATE=48000
ID_AUDIO_NCH=2
ID_START_TIME=0.00
ID_LENGTH=7392.49
ID_SEEKABLE=1
ID_CHAPTERS=0
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
libavcodec version 56.60.100 (external)
Selected video codec: [ffh264] vfm: ffmpeg (FFmpeg H.264)
==========================================================================
ID_VIDEO_CODEC=ffh264
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 48000 Hz, 2 ch, floatle, 159.9 kbit/5.21% (ratio: 19992->384000)
ID_AUDIO_BITRATE=159936
ID_AUDIO_RATE=48000
ID_AUDIO_NCH=2
Selected audio codec: [ffaac] afm: ffmpeg (FFmpeg AAC (MPEG-2/MPEG-4 Audio))
==========================================================================
AO: [null] 48000Hz 2ch floatle (4 bytes per sample)
ID_AUDIO_CODEC=ffaac
Starting playback...


Exiting... (End of file)
ID_EXIT=EOF

I dont need the metadata.
Reply
#4
What information do you want to read?
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#5
well the video like separate frames and audio in raw data
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How can i fix json.decoder.JSONDecodeError ? JgKSuperstar 9 4,601 Oct-30-2021, 11:23 PM
Last Post: JgKSuperstar
  coding a decoder... Popkhorn 2 2,106 May-28-2020, 07:26 AM
Last Post: Popkhorn
  reset on inactivity (building a morse decoder) gerrit1985 7 3,535 Apr-17-2020, 10:22 AM
Last Post: deanhystad
  UTF-8 decoder reports bad byte that is not there Skaperen 0 2,288 Oct-11-2018, 04:46 AM
Last Post: Skaperen
  JSON Decoder issue Cronax3 2 9,766 Sep-13-2017, 09:23 AM
Last Post: Cronax3

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020