Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen angezeigt.
Beide Seiten der vorigen Revision Vorhergehende Überarbeitung Nächste Überarbeitung | Vorhergehende Überarbeitung | ||
systemverwaltung:user_info:howto:videoedit [2015/04/15 11:43] admin [CLI Tools: avconv, mp4box] |
systemverwaltung:user_info:howto:videoedit [2021/12/02 11:27] (aktuell) |
||
---|---|---|---|
Zeile 1: | Zeile 1: | ||
====== Video Editing ====== | ====== Video Editing ====== | ||
+ | First you should install some video related packages: | ||
+ | apt-get install libav-tools vlc | ||
+ | | ||
+ | optional: | ||
+ | apt-get install mediainfo | ||
===== Convert ===== | ===== Convert ===== | ||
- | Convert MTS files with AVCHD to MP4 Format | + | Some Cameras divide the recording in several pieces. |
+ | Then you first should concatenate with | ||
+ | '' | ||
+ | Convert MTS files with AVCHD video format and ac3 sound format | ||
+ | to MP4 and aac format. | ||
- | ==== Handbrake ==== | + | <code bash> |
+ | # | ||
+ | # put here original size of movie: | ||
+ | SIZE=1920x1080 | ||
+ | avconv-copy() { | ||
+ | | ||
+ | } | ||
+ | case " | ||
+ | (avconv) | ||
+ | | ||
+ | ;; | ||
+ | (avconv-resize) | ||
+ | | ||
+ | ;; | ||
+ | (avconv-full) | ||
+ | | ||
+ | | ||
+ | ;; | ||
+ | (*) | ||
+ | echo " | ||
+ | ;; | ||
+ | esac | ||
+ | </ | ||
+ | ====== Handbrake | ||
Tool in ubuntu packages from [[https:// | Tool in ubuntu packages from [[https:// | ||
+ | Intermediate format on Linux is MKV because this is the most free video package | ||
- | ==== xmodulo ==== | + | ====== xmodulo ====== |
- | ==== CLI Tools: avconv, mp4box, ffmpeg ==== | + | .... |
- | === avconv === | + | ====== CLI Tools: |
+ | ===== avconv ===== | ||
<code bash> | <code bash> | ||
Zeile 31: | Zeile 64: | ||
winff - graphical video and audio batch converter using ffmpeg or avconv | winff - graphical video and audio batch converter using ffmpeg or avconv | ||
- | === mp4box === | + | ===== mp4box |
| | ||
Zeile 46: | Zeile 79: | ||
</ | </ | ||
- | === ffmpeg === | + | ===== ffmpeg ===== |
+ | |||
+ | // | ||
+ | |||
+ | This package is very common but discontinued. | ||
<code bash> | <code bash> | ||
Zeile 73: | Zeile 110: | ||
# see: http:// | # see: http:// | ||
+ | http:// | ||
+ | |||
+ | ===== mencoder ===== | ||
+ | |||
+ | Question: How to convert AVCHD (MTS/M2TS) to MP4 __losslessly__. | ||
+ | |||
+ | I'll start with the end: | ||
+ | |||
+ | <code bash> | ||
+ | mencoder infile.mts -demuxer lavf -oac copy -ovc copy -of lavf=mp4 -o outfile.mp4 | ||
+ | </ | ||
+ | |||
+ | and now to explain myself: | ||
+ | |||
+ | AVCHD (MTS) is basically a container format for MPEG4-AVC video and AC-3 Audio. It's commonly found on modern camcorders. I have pulled files off a Sony Camcorder, which records in 1080i@50Hz. It seems there are timestamp problems, and both the even and odd fields are stamped with the same time, and not 1/50th of a second apart as you'd expect. This currently breaks ffmpeg (0.6~svn20100711), | ||
+ | |||
+ | If you run ' | ||
+ | < | ||
+ | General | ||
+ | ID : 0 | ||
+ | Complete name : infile.mts | ||
+ | Format | ||
+ | Format/ | ||
+ | File size : 62.6 MiB | ||
+ | Duration | ||
+ | Overall bit rate : 9 364 Kbps | ||
+ | Maximum Overall bit rate : 18.0 Mbps | ||
+ | |||
+ | Video | ||
+ | ID : 4113 (0x1011) | ||
+ | Menu ID : 1 (0x1) | ||
+ | Format | ||
+ | Format/ | ||
+ | Format profile | ||
+ | Format settings, CABAC : Yes | ||
+ | Format settings, ReFrames | ||
+ | Duration | ||
+ | Bit rate : 8 726 Kbps | ||
+ | Width : 1 440 pixels | ||
+ | Height | ||
+ | Display aspect ratio : 16:9 | ||
+ | Frame rate : 25.000 fps | ||
+ | Resolution | ||
+ | Colorimetry | ||
+ | Scan type : Interlaced | ||
+ | Scan order : Top Field First | ||
+ | Bits/ | ||
+ | Stream size : 58.3 MiB (93%) | ||
+ | |||
+ | Audio | ||
+ | ID : 4352 (0x1100) | ||
+ | Menu ID : 1 (0x1) | ||
+ | Format | ||
+ | Format/ | ||
+ | Duration | ||
+ | Bit rate mode : Constant | ||
+ | Bit rate : 256 Kbps | ||
+ | Channel(s) | ||
+ | Channel positions | ||
+ | Sampling rate : 48.0 KHz | ||
+ | Video delay : -80ms | ||
+ | Stream size : 1.71 MiB (3%) | ||
+ | |||
+ | Text | ||
+ | ID : 4608 (0x1200) | ||
+ | Menu ID : 1 (0x1) | ||
+ | Format | ||
+ | Duration | ||
+ | Video delay : -80ms | ||
+ | </ | ||
+ | |||
+ | Once you run it through the above command, the resultant container will look like this. The audio/video codec details will be the same because it's a straight (lossless) copy. Also note that the headers have been corrected from 25i to 50i. | ||
+ | < | ||
+ | General | ||
+ | Complete name : outfile.mp4 | ||
+ | Format | ||
+ | Format profile | ||
+ | Codec ID : isom | ||
+ | File size : 58.7 MiB | ||
+ | Duration | ||
+ | Overall bit rate : 8 761 Kbps | ||
+ | Writing application | ||
+ | |||
+ | Video | ||
+ | ID : 1 | ||
+ | Format | ||
+ | Format/ | ||
+ | Format profile | ||
+ | Format settings, CABAC : Yes | ||
+ | Format settings, ReFrames | ||
+ | Format_Settings_FrameMode | ||
+ | Codec ID : avc1 | ||
+ | Codec ID/ | ||
+ | Duration | ||
+ | Bit rate mode : Variable | ||
+ | Bit rate : 8 504 Kbps | ||
+ | Width : 1 440 pixels | ||
+ | Height | ||
+ | Display aspect ratio : 4:3 | ||
+ | Original display aspect ratio : 16:9 | ||
+ | Frame rate mode : Constant | ||
+ | Frame rate : 50.000 fps | ||
+ | Original frame rate : 8.333 fps | ||
+ | Resolution | ||
+ | Colorimetry | ||
+ | Scan type : Interlaced | ||
+ | Scan order : Top Field First | ||
+ | Bits/ | ||
+ | Stream size : 56.9 MiB (97%) | ||
+ | |||
+ | Audio | ||
+ | ID : 2 | ||
+ | Format | ||
+ | Format/ | ||
+ | Codec ID : ac-3 | ||
+ | Duration | ||
+ | Bit rate mode : Constant | ||
+ | Bit rate : 256 Kbps | ||
+ | Channel(s) | ||
+ | Channel positions | ||
+ | Sampling rate : 48.0 KHz | ||
+ | Resolution | ||
+ | Stream size : 1.71 MiB (3%) | ||
+ | </ | ||
+ | |||
+ | Note that the final video will still be interlaced. __Removing the interlacing requires re-encoding.__ | ||
+ | (This was tested on 10.04 with the VDPAU team's cutting-edge-multimedia PPA installed.) | ||
+ | |||
+ | by pHr34kY; September 11th, 2010 at 11:55 AM. | ||
+ | Advanced reply | ||
+ | September 14th, 2010 #2 | ||
+ | |||
+ | I want to do this on files from a canon hg-21. Here is my output from mediainfo: | ||
+ | < | ||
+ | General | ||
+ | ID : 0 | ||
+ | Complete name : 00069.MTS | ||
+ | Format : BDAV | ||
+ | Format/Info : BluRay Video | ||
+ | File size : 272 MiB | ||
+ | Duration : 1mn 36s | ||
+ | Overall bit rate : 23.8 Mbps | ||
+ | Maximum Overall bit rate : 24.0 Mbps | ||
+ | |||
+ | Video | ||
+ | ID : 4113 (0x1011) | ||
+ | Menu ID : 1 (0x1) | ||
+ | Format : AVC | ||
+ | Format/Info : Advanced Video Codec | ||
+ | Format profile : High@L4.0 | ||
+ | Format settings, CABAC : Yes | ||
+ | Format settings, ReFrames : 2 frames | ||
+ | Duration : 1mn 35s | ||
+ | Bit rate : 22.6 Mbps | ||
+ | Width : 1 920 pixels | ||
+ | Height : 1 080 pixels | ||
+ | Display aspect ratio : 16/9 | ||
+ | Frame rate : 29.970 fps | ||
+ | Resolution : 24 bits | ||
+ | Colorimetry : 4:2:0 | ||
+ | Scan type : Interlaced | ||
+ | Scan order : Top Field First | ||
+ | Bits/ | ||
+ | |||
+ | Audio | ||
+ | ID : 4352 (0x1100) | ||
+ | Menu ID : 1 (0x1) | ||
+ | Format : AC-3 | ||
+ | Format/Info : Audio Coding 3 | ||
+ | Duration : 1mn 36s | ||
+ | Bit rate mode : Constant | ||
+ | Bit rate : 256 Kbps | ||
+ | Channel(s) : 2 channels | ||
+ | Channel positions : L R | ||
+ | Sampling rate : 48.0 KHz | ||
+ | Video delay : -66ms | ||
+ | </ | ||
+ | |||
+ | This is after conversion: | ||
+ | |||
+ | < | ||
+ | General | ||
+ | Complete name : RyanFreakout.mp4 | ||
+ | Format : MPEG-4 | ||
+ | Format profile : Base Media | ||
+ | Codec ID : isom | ||
+ | File size : 260 MiB | ||
+ | Duration : 1mn 36s | ||
+ | Overall bit rate : 22.7 Mbps | ||
+ | Encoded date : UTC 1970-01-01 00:00:00 | ||
+ | Tagged date : UTC 1970-01-01 00:00:00 | ||
+ | Writing application : Lavf52.31.0 | ||
+ | |||
+ | Video | ||
+ | Format : AVC | ||
+ | Format/Info : Advanced Video Codec | ||
+ | Format profile : High@L4.0 | ||
+ | Format settings, CABAC : Yes | ||
+ | Format settings, ReFrames : 2 frames | ||
+ | Codec ID : avc1 | ||
+ | Codec ID/Info : Advanced Video Coding | ||
+ | Duration : 1mn 36s | ||
+ | Bit rate mode : Variable | ||
+ | Bit rate : 22.4 Mbps | ||
+ | Width : 1 920 pixels | ||
+ | Height : 1 080 pixels | ||
+ | Display aspect ratio : 16/9 | ||
+ | Frame rate mode : Constant | ||
+ | Frame rate : 59.940 fps | ||
+ | Original frame rate : 29.970 fps | ||
+ | Resolution : 24 bits | ||
+ | Colorimetry : 4:2:0 | ||
+ | Scan type : Progressive | ||
+ | Bits/ | ||
+ | Stream size : 257 MiB (99%) | ||
+ | Encoded date : UTC 1970-01-01 00:00:00 | ||
+ | Tagged date : UTC 1970-01-01 00:00:00 | ||
+ | |||
+ | Audio | ||
+ | Format : AC-3 | ||
+ | Format/Info : Audio Coding 3 | ||
+ | Codec ID : ac-3 | ||
+ | Duration : 1mn 36s | ||
+ | Bit rate mode : Constant | ||
+ | Bit rate : 256 Kbps | ||
+ | Channel(s) : 2 channels | ||
+ | Channel positions : L R | ||
+ | Sampling rate : 48.0 KHz | ||
+ | Resolution : 16 bits | ||
+ | Stream size : 2.93 MiB (1%) | ||
+ | Encoded date : UTC 1970-01-01 00:00:00 | ||
+ | Tagged date : UTC 1970-01-01 00:00:00 | ||
+ | </ | ||
+ | |||
+ | Does everything look right? The playback on .mp4 is still obviously interlaced but it seems to be worse than before. When usually I get better playback. Previously, I had always used Adobe Media Encoder on Windows (deinterlaces the file). Can I deinterlace this file (reencode with '' | ||
+ | |||
+ | > | ||
+ | > | ||
+ | >Looking to convert MTS into a usable format too ... | ||
+ | > | ||
+ | > | ||
+ | > | ||
+ | > Input #0, mpegts, from '/ | ||
+ | > Duration: 00: | ||
+ | > Program 1 | ||
+ | > Stream # | ||
+ | > Stream # | ||
+ | > Unknown encoder ' | ||
+ | > Press Enter to Continue ... | ||
+ | > | ||
+ | > | ||
+ | > | ||
+ | >> Re: How to convert AVCHD (MTS/M2TS) to MP4 losslessly.> | ||
+ | >> Unknown encoder ' | ||
+ | >> Looks like your copy of FFmpeg has not been compiled for mp3 encoding, | ||
+ | >> have a look here for the fix: | ||
+ | >> HOWTO: Easily enable MP3, MPEG4, AAC, and other restricted encoders in FFmpeg | ||
+ | >> http:// | ||