Convert MP4 files to video with chapters? #6945

Open
opened 2026-02-21 03:27:50 -05:00 by deekerman · 4 comments
Owner

Originally created by @gdeward on GitHub (Feb 16, 2016).

What is the easiest way to merge all of the downloaded videos into one single video file with chapters? Would there be a max size (duration) for the video? I'm currently pulling down Pluralsight courses and would like to use the name of each file for the chapters. The goal would be to include the video in iTunes and be able to skip backwards or forwards by chapter.

Originally created by @gdeward on GitHub (Feb 16, 2016). What is the easiest way to merge all of the downloaded videos into one single video file with chapters? Would there be a max size (duration) for the video? I'm currently pulling down Pluralsight courses and would like to use the name of each file for the chapters. The goal would be to include the video in iTunes and be able to skip backwards or forwards by chapter.
Author
Owner

@dstftw commented on GitHub (Feb 16, 2016):

That is not possible with youtube-dl.

@dstftw commented on GitHub (Feb 16, 2016): That is not possible with youtube-dl.
Author
Owner

@gdeward commented on GitHub (Feb 16, 2016):

Understood. I was hoping one of the youtube-dl gurus knew of a method.

@gdeward commented on GitHub (Feb 16, 2016): Understood. I was hoping one of the youtube-dl gurus knew of a method.
Author
Owner

@treaki commented on GitHub (Feb 17, 2016):

you can use ffmpeg for that like i do here:

treaki@debian7:~/Videos/rick_and_morty$ #first of all i create a list of all files to be concatenated...
treaki@debian7:~/Videos/rick_and_morty$ ls Rick\ and\ Morty\ -\ Close\ Rick-Counters\ of\ the\ Rick\ Kind\ Part* > ick\ and\ Morty\ -\ Close\ Rick-Counters\ of\ the\ Rick\ Kind\ Parts.txt
treaki@debian7:~/Videos/rick_and_morty$ #than i modify it with a text editor to look like this:
treaki@debian7:~/Videos/rick_and_morty$ cat Rick\ and\ Morty\ -\ Close\ Rick-Counters\ of\ the\ Rick\ Kind\ Parts.txt 
file 'Rick and Morty - Close Rick-Counters of the Rick Kind Part 1-k-CbT8RlRVmK8QhM20IYxg-0.flv'
file 'Rick and Morty - Close Rick-Counters of the Rick Kind Part 2-k-CbT8RlRVmK8QhM20IYxg-1.flv'
file 'Rick and Morty - Close Rick-Counters of the Rick Kind Part 3-k-CbT8RlRVmK8QhM20IYxg-2.flv'
file 'Rick and Morty - Close Rick-Counters of the Rick Kind Part 4-k-CbT8RlRVmK8QhM20IYxg-3.flv'
treaki@debian7:~/Videos/rick_and_morty$ #with this command i start the concat process to create one large file out of them
treaki@debian7:~/Videos/rick_and_morty$ ffmpeg -f concat -i Rick\ and\ Morty\ -\ Close\ Rick-Counters\ of\ the\ Rick\ Kind\ Parts.txt -movflags faststart -vcodec copy -acodec copy Rick\ and\ Morty\ -\ Close\ Rick-Counters\ of\ the\ Rick\ Kind.mp4
ffmpeg version 2.6.3 Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.9.2 (Debian 4.9.2-10)
  configuration: --prefix=/usr --extra-cflags='-g -O2 -fstack-protector-strong -Wformat -Werror=format-security ' --extra-ldflags='-Wl,-z,relro' --cc='ccache cc' --enable-shared --enable-libmp3lame --enable-gpl --enable-nonfree --enable-libvorbis --enable-pthreads --enable-libfaac --enable-libxvid --enable-postproc --enable-x11grab --enable-libgsm --enable-libtheora --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libx264 --enable-libspeex --enable-nonfree --disable-stripping --enable-libvpx --enable-libschroedinger --disable-encoder=libschroedinger --enable-version3 --enable-libopenjpeg --enable-librtmp --enable-avfilter --enable-libfreetype --enable-libvo-aacenc --disable-decoder=amrnb --enable-libvo-amrwbenc --enable-libaacplus --libdir=/usr/lib/x86_64-linux-gnu --disable-vda --enable-libbluray --enable-libcdio --enable-gnutls --enable-frei0r --enable-openssl --enable-libass --enable-libopus --enable-fontconfig --enable-libpulse --disable-mips32r2 --disable-mipsdspr1 --disable-mipsdspr2 --enable-libvidstab --enable-libzvbi --enable-avresample --disable-htmlpages --disable-podpages --enable-libutvideo --enable-libfdk-aac --enable-libx265 --enable-libiec61883 --enable-vaapi --enable-libdc1394 --disable-altivec --shlibdir=/usr/lib/x86_64-linux-gnu
  libavutil      54. 20.100 / 54. 31.100
  libavcodec     56. 26.100 / 56. 60.100
  libavformat    56. 25.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 11.102 /  5. 40.101
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x1d44200] Auto-inserting h264_mp4toannexb bitstream filter
Input #0, concat, from 'Rick and Morty - Close Rick-Counters of the Rick Kind Parts.txt':
  Duration: N/A, start: 0.000000, bitrate: 3495 kb/s
    Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv), 1280x720 [SAR 1:1 DAR 16:9], 3367 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc
    Metadata:
      creation_time   : 2014-04-22 20:31:52
      handler_name    : Video Media Handler
      encoder         : AVC Coding
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s
    Metadata:
      creation_time   : 2014-04-22 20:31:52
      handler_name    : Sound Media Handler
    Stream #0:2(eng): Subtitle: mov_text (tx3g / 0x67337874), 1280x720, 2 kb/s
    Metadata:
      creation_time   : 2014-04-22 20:31:52
      handler_name    : Subtitle Handler
Output #0, mp4, to 'Rick and Morty - Close Rick-Counters of the Rick Kind.mp4':
  Metadata:
    encoder         : Lavf56.40.101
    Stream #0:0(eng): Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 3367 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 30k tbc
    Metadata:
      creation_time   : 2014-04-22 20:31:52
      handler_name    : Video Media Handler
      encoder         : AVC Coding
    Stream #0:1(eng): Audio: aac ([64][0][0][0] / 0x0040), 44100 Hz, stereo, 125 kb/s
    Metadata:
      creation_time   : 2014-04-22 20:31:52
      handler_name    : Sound Media Handler
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x215cc00] Auto-inserting h264_mp4toannexb bitstream filter
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x215cc00] Auto-inserting h264_mp4toannexb bitstream filter
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x215cc00] Auto-inserting h264_mp4toannexb bitstream filter
[mp4 @ 0x206aba0] Starting second pass: moving the moov atom to the beginning of the file
frame=40328 fps=550 q=-1.0 Lsize=  567547kB time=00:22:25.64 bitrate=3455.1kbits/s    
video:545549kB audio:20630kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.241577%
treaki@debian7:~/Videos/rick_and_morty$ # now i need to know the length of every file...
treaki@debian7:~/Videos/rick_and_morty$ ffmpeg -i Rick\ and\ Morty\ -\ Close\ Rick-Counters\ of\ the\ Rick\ Kind\ Part\ 1-k-CbT8RlRVmK8QhM20IYxg-0.flv -i Rick\ and\ Morty\ -\ Close\ Rick-Counters\ of\ the\ Rick\ Kind\ Part\ 2-k-CbT8RlRVmK8QhM20IYxg-1.flv -i Rick\ and\ Morty\ -\ Close\ Rick-Counters\ of\ the\ Rick\ Kind\ Part\ 3-k-CbT8RlRVmK8QhM20IYxg-2.flv -i Rick\ and\ Morty\ -\ Close\ Rick-Counters\ of\ the\ Rick\ Kind\ Part\ 4-k-CbT8RlRVmK8QhM20IYxg-3.flv 
ffmpeg version 2.6.3 Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.9.2 (Debian 4.9.2-10)
  configuration: --prefix=/usr --extra-cflags='-g -O2 -fstack-protector-strong -Wformat -Werror=format-security ' --extra-ldflags='-Wl,-z,relro' --cc='ccache cc' --enable-shared --enable-libmp3lame --enable-gpl --enable-nonfree --enable-libvorbis --enable-pthreads --enable-libfaac --enable-libxvid --enable-postproc --enable-x11grab --enable-libgsm --enable-libtheora --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libx264 --enable-libspeex --enable-nonfree --disable-stripping --enable-libvpx --enable-libschroedinger --disable-encoder=libschroedinger --enable-version3 --enable-libopenjpeg --enable-librtmp --enable-avfilter --enable-libfreetype --enable-libvo-aacenc --disable-decoder=amrnb --enable-libvo-amrwbenc --enable-libaacplus --libdir=/usr/lib/x86_64-linux-gnu --disable-vda --enable-libbluray --enable-libcdio --enable-gnutls --enable-frei0r --enable-openssl --enable-libass --enable-libopus --enable-fontconfig --enable-libpulse --disable-mips32r2 --disable-mipsdspr1 --disable-mipsdspr2 --enable-libvidstab --enable-libzvbi --enable-avresample --disable-htmlpages --disable-podpages --enable-libutvideo --enable-libfdk-aac --enable-libx265 --enable-libiec61883 --enable-vaapi --enable-libdc1394 --disable-altivec --shlibdir=/usr/lib/x86_64-linux-gnu
  libavutil      54. 20.100 / 54. 31.100
  libavcodec     56. 26.100 / 56. 60.100
  libavformat    56. 25.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 11.102 /  5. 40.101
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Rick and Morty - Close Rick-Counters of the Rick Kind Part 1-k-CbT8RlRVmK8QhM20IYxg-0.flv':
  Metadata:
    major_brand     : f4v 
    minor_version   : 0
    compatible_brands: mp42iso2isomavc1
    creation_time   : 2014-04-22 20:31:52
  Duration: 00:06:53.59, start: 0.000000, bitrate: 3500 kb/s
    Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv), 1280x720 [SAR 1:1 DAR 16:9], 3367 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
    Metadata:
      creation_time   : 2014-04-22 20:31:52
      handler_name    : Video Media Handler
      encoder         : AVC Coding
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s (default)
    Metadata:
      creation_time   : 2014-04-22 20:31:52
      handler_name    : Sound Media Handler
    Stream #0:2(eng): Subtitle: mov_text (tx3g / 0x67337874), 1280x720, 2 kb/s (default)
    Metadata:
      creation_time   : 2014-04-22 20:31:52
      handler_name    : Subtitle Handler
Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'Rick and Morty - Close Rick-Counters of the Rick Kind Part 2-k-CbT8RlRVmK8QhM20IYxg-1.flv':
  Metadata:
    major_brand     : f4v 
    minor_version   : 0
    compatible_brands: mp42iso2isomavc1
    creation_time   : 2014-06-24 04:38:48
  Duration: 00:06:25.22, start: 0.000000, bitrate: 3504 kb/s
    Stream #1:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv), 1280x720 [SAR 1:1 DAR 16:9], 3370 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
    Metadata:
      creation_time   : 2014-06-24 04:38:48
      handler_name    : Video Media Handler
      encoder         : AVC Coding
    Stream #1:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s (default)
    Metadata:
      creation_time   : 2014-06-24 04:38:48
      handler_name    : Sound Media Handler
    Stream #1:2(eng): Subtitle: mov_text (tx3g / 0x67337874), 1280x720, 3 kb/s (default)
    Metadata:
      creation_time   : 2014-06-24 04:38:48
      handler_name    : Subtitle Handler
Input #2, mov,mp4,m4a,3gp,3g2,mj2, from 'Rick and Morty - Close Rick-Counters of the Rick Kind Part 3-k-CbT8RlRVmK8QhM20IYxg-2.flv':
  Metadata:
    major_brand     : f4v 
    minor_version   : 0
    compatible_brands: mp42iso2isomavc1
    creation_time   : 2014-04-22 19:26:08
  Duration: 00:05:22.57, start: 0.000000, bitrate: 3503 kb/s
    Stream #2:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv), 1280x720 [SAR 1:1 DAR 16:9], 3370 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
    Metadata:
      creation_time   : 2014-04-22 19:26:08
      handler_name    : Video Media Handler
      encoder         : AVC Coding
    Stream #2:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s (default)
    Metadata:
      creation_time   : 2014-04-22 19:26:08
      handler_name    : Sound Media Handler
    Stream #2:2(eng): Subtitle: mov_text (tx3g / 0x67337874), 1280x720, 2 kb/s (default)
    Metadata:
      creation_time   : 2014-04-22 19:26:08
      handler_name    : Subtitle Handler
Input #3, mov,mp4,m4a,3gp,3g2,mj2, from 'Rick and Morty - Close Rick-Counters of the Rick Kind Part 4-k-CbT8RlRVmK8QhM20IYxg-3.flv':
  Metadata:
    major_brand     : f4v 
    minor_version   : 0
    compatible_brands: mp42iso2isomavc1
    creation_time   : 2014-04-22 18:51:56
  Duration: 00:03:44.26, start: 0.000000, bitrate: 3213 kb/s
    Stream #3:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv), 1280x720 [SAR 1:1 DAR 16:9], 3081 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
    Metadata:
      creation_time   : 2014-04-22 18:51:56
      handler_name    : Video Media Handler
      encoder         : AVC Coding
    Stream #3:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s (default)
    Metadata:
      creation_time   : 2014-04-22 18:51:56
      handler_name    : Sound Media Handler
    Stream #3:2(eng): Subtitle: mov_text (tx3g / 0x67337874), 1280x720, 2 kb/s (default)
    Metadata:
      creation_time   : 2014-04-22 18:51:56
      handler_name    : Subtitle Handler
At least one output file must be specified
treaki@debian7:~/Videos/rick_and_morty$ #then i have to calculate the chapters beginnings and endings:
treaki@debian7:~/Videos/rick_and_morty$ bc -l
bc 1.06.95
Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'. 
06*60+53.59
413.59
06*60+25.22
385.22
385.22+413.59
798.81
05*60+22.57
322.57
322.57+798.81
1121.38
03*60+44.26
224.26
224.26+1121.38
1345.64
treaki@debian7:~/Videos/rick_and_morty$ #and write them into one chapter metadata file
treaki@debian7:~/Videos/rick_and_morty$ cat > 'Rick and Morty - Close Rick-Counters of the Rick Kind'_chapters.txt
;FFMETADATA1
[CHAPTER]
TIMEBASE=1/1000
START=0
END=413590
title=Part 1
[CHAPTER]
TIMEBASE=1/1000
START=413590
END=798810     
title=Part 2
[CHAPTER]
TIMEBASE=1/1000
START=798810
END=1121380
title=Part 3
[CHAPTER]
TIMEBASE=1/1000
START=1121380
END=1345640
title=Part 4
treaki@debian7:~/Videos/rick_and_morty$ #now i add the chapter information together with video and audio to a new file
treaki@debian7:~/Videos/rick_and_morty$ ffmpeg -i Rick\ and\ Morty\ -\ Close\ Rick-Counters\ of\ the\ Rick\ Kind.mp4 -i Rick\ and\ Morty\ -\ Close\ Rick-Counters\ of\ the\ Rick\ Kind_chapters.txt -vcodec copy -acodec copy -map_chapters 1 -movflags faststart Rick\ and\ Morty\ -\ Close\ Rick-Counters\ of\ the\ Rick\ Kind_with_chapters.mp4
ffmpeg version 2.6.3 Copyright (c) 2000-2015 the FFmpeg developers
  built with gcc 4.9.2 (Debian 4.9.2-10)
  configuration: --prefix=/usr --extra-cflags='-g -O2 -fstack-protector-strong -Wformat -Werror=format-security ' --extra-ldflags='-Wl,-z,relro' --cc='ccache cc' --enable-shared --enable-libmp3lame --enable-gpl --enable-nonfree --enable-libvorbis --enable-pthreads --enable-libfaac --enable-libxvid --enable-postproc --enable-x11grab --enable-libgsm --enable-libtheora --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libx264 --enable-libspeex --enable-nonfree --disable-stripping --enable-libvpx --enable-libschroedinger --disable-encoder=libschroedinger --enable-version3 --enable-libopenjpeg --enable-librtmp --enable-avfilter --enable-libfreetype --enable-libvo-aacenc --disable-decoder=amrnb --enable-libvo-amrwbenc --enable-libaacplus --libdir=/usr/lib/x86_64-linux-gnu --disable-vda --enable-libbluray --enable-libcdio --enable-gnutls --enable-frei0r --enable-openssl --enable-libass --enable-libopus --enable-fontconfig --enable-libpulse --disable-mips32r2 --disable-mipsdspr1 --disable-mipsdspr2 --enable-libvidstab --enable-libzvbi --enable-avresample --disable-htmlpages --disable-podpages --enable-libutvideo --enable-libfdk-aac --enable-libx265 --enable-libiec61883 --enable-vaapi --enable-libdc1394 --disable-altivec --shlibdir=/usr/lib/x86_64-linux-gnu
  libavutil      54. 20.100 / 54. 31.100
  libavcodec     56. 26.100 / 56. 60.100
  libavformat    56. 25.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 11.102 /  5. 40.101
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  1.100 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Rick and Morty - Close Rick-Counters of the Rick Kind.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf56.40.101
  Duration: 00:22:25.64, start: 0.000000, bitrate: 3455 kb/s
    Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv), 1280x720 [SAR 1:1 DAR 16:9], 3321 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Input #1, ffmetadata, from 'Rick and Morty - Close Rick-Counters of the Rick Kind_chapters.txt':
  Duration: 00:22:25.64, start: 0.000000, bitrate: 0 kb/s
    Chapter #1:0: start 0.000000, end 413.590000
    Metadata:
      title           : Part 1
    Chapter #1:1: start 413.590000, end 798.810000
    Metadata:
      title           : Part 2
    Chapter #1:2: start 798.810000, end 1121.380000
    Metadata:
      title           : Part 3
    Chapter #1:3: start 1121.380000, end 1345.640000
    Metadata:
      title           : Part 4
Output #0, mp4, to 'Rick and Morty - Close Rick-Counters of the Rick Kind_with_chapters.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf56.40.101
    Chapter #0:0: start 0.000000, end 413.590000
    Metadata:
      title           : Part 1
    Chapter #0:1: start 413.590000, end 798.810000
    Metadata:
      title           : Part 2
    Chapter #0:2: start 798.810000, end 1121.380000
    Metadata:
      title           : Part 3
    Chapter #0:3: start 1121.380000, end 1345.640000
    Metadata:
      title           : Part 4
    Stream #0:0(eng): Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 3321 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 30k tbc (default)
    Metadata:
      handler_name    : VideoHandler
    Stream #0:1(eng): Audio: aac ([64][0][0][0] / 0x0040), 44100 Hz, stereo, 125 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[mp4 @ 0x258fde0] Starting second pass: moving the moov atom to the beginning of the file
frame=40328 fps=857 q=-1.0 Lsize=  567547kB time=00:22:25.64 bitrate=3455.1kbits/s    
video:545588kB audio:20630kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.234733%
treaki@debian7:~/Videos/rick_and_morty$ #now i am done and can enjoy my work
treaki@debian7:~/Videos/rick_and_morty$ mpv Rick\ and\ Morty\ -\ Close\ Rick-Counters\ of\ the\ Rick\ Kind_with_chapters.mp4 
Warning: mpv was compiled against a different version of ffmpeg than the shared
library it is linked against. This can expose subtle ABI compatibility issues
and can lead to misbehavior and crashes.
Playing: Rick and Morty - Close Rick-Counters of the Rick Kind_with_chapters.mp4
 (+) Video --vid=1 (*) (h264)
 (+) Audio --aid=1 --alang=eng (*) (aac)
     Subs  --sid=1 --slang=eng (mov_text)
AO: [pulse] 44100Hz stereo 2ch float
VO: [opengl] 1280x720 yuv420p
AV: 00:00:00 / 00:22:25 (0%) A-V:  0.000
[vo/opengl/x11] Disabling screensaver failed.
AV: 00:00:04 / 00:22:25 (0%) A-V:  0.000


Exiting... (Quit)
treaki@debian7:~/Videos/rick_and_morty$ #and of cause delete the temporary file
treaki@debian7:~/Videos/rick_and_morty$ rm Rick\ and\ Morty\ -\ Close\ Rick-Counters\ of\ the\ Rick\ Kind.mp4 
treaki@debian7:~/Videos/rick_and_morty$ 
@treaki commented on GitHub (Feb 17, 2016): you can use ffmpeg for that like i do here: ``` treaki@debian7:~/Videos/rick_and_morty$ #first of all i create a list of all files to be concatenated... treaki@debian7:~/Videos/rick_and_morty$ ls Rick\ and\ Morty\ -\ Close\ Rick-Counters\ of\ the\ Rick\ Kind\ Part* > ick\ and\ Morty\ -\ Close\ Rick-Counters\ of\ the\ Rick\ Kind\ Parts.txt treaki@debian7:~/Videos/rick_and_morty$ #than i modify it with a text editor to look like this: treaki@debian7:~/Videos/rick_and_morty$ cat Rick\ and\ Morty\ -\ Close\ Rick-Counters\ of\ the\ Rick\ Kind\ Parts.txt file 'Rick and Morty - Close Rick-Counters of the Rick Kind Part 1-k-CbT8RlRVmK8QhM20IYxg-0.flv' file 'Rick and Morty - Close Rick-Counters of the Rick Kind Part 2-k-CbT8RlRVmK8QhM20IYxg-1.flv' file 'Rick and Morty - Close Rick-Counters of the Rick Kind Part 3-k-CbT8RlRVmK8QhM20IYxg-2.flv' file 'Rick and Morty - Close Rick-Counters of the Rick Kind Part 4-k-CbT8RlRVmK8QhM20IYxg-3.flv' treaki@debian7:~/Videos/rick_and_morty$ #with this command i start the concat process to create one large file out of them treaki@debian7:~/Videos/rick_and_morty$ ffmpeg -f concat -i Rick\ and\ Morty\ -\ Close\ Rick-Counters\ of\ the\ Rick\ Kind\ Parts.txt -movflags faststart -vcodec copy -acodec copy Rick\ and\ Morty\ -\ Close\ Rick-Counters\ of\ the\ Rick\ Kind.mp4 ffmpeg version 2.6.3 Copyright (c) 2000-2015 the FFmpeg developers built with gcc 4.9.2 (Debian 4.9.2-10) configuration: --prefix=/usr --extra-cflags='-g -O2 -fstack-protector-strong -Wformat -Werror=format-security ' --extra-ldflags='-Wl,-z,relro' --cc='ccache cc' --enable-shared --enable-libmp3lame --enable-gpl --enable-nonfree --enable-libvorbis --enable-pthreads --enable-libfaac --enable-libxvid --enable-postproc --enable-x11grab --enable-libgsm --enable-libtheora --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libx264 --enable-libspeex --enable-nonfree --disable-stripping --enable-libvpx --enable-libschroedinger --disable-encoder=libschroedinger --enable-version3 --enable-libopenjpeg --enable-librtmp --enable-avfilter --enable-libfreetype --enable-libvo-aacenc --disable-decoder=amrnb --enable-libvo-amrwbenc --enable-libaacplus --libdir=/usr/lib/x86_64-linux-gnu --disable-vda --enable-libbluray --enable-libcdio --enable-gnutls --enable-frei0r --enable-openssl --enable-libass --enable-libopus --enable-fontconfig --enable-libpulse --disable-mips32r2 --disable-mipsdspr1 --disable-mipsdspr2 --enable-libvidstab --enable-libzvbi --enable-avresample --disable-htmlpages --disable-podpages --enable-libutvideo --enable-libfdk-aac --enable-libx265 --enable-libiec61883 --enable-vaapi --enable-libdc1394 --disable-altivec --shlibdir=/usr/lib/x86_64-linux-gnu libavutil 54. 20.100 / 54. 31.100 libavcodec 56. 26.100 / 56. 60.100 libavformat 56. 25.101 / 56. 40.101 libavdevice 56. 4.100 / 56. 4.100 libavfilter 5. 11.102 / 5. 40.101 libavresample 2. 1. 0 / 2. 1. 0 libswscale 3. 1.101 / 3. 1.101 libswresample 1. 1.100 / 1. 2.101 libpostproc 53. 3.100 / 53. 3.100 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x1d44200] Auto-inserting h264_mp4toannexb bitstream filter Input #0, concat, from 'Rick and Morty - Close Rick-Counters of the Rick Kind Parts.txt': Duration: N/A, start: 0.000000, bitrate: 3495 kb/s Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv), 1280x720 [SAR 1:1 DAR 16:9], 3367 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc Metadata: creation_time : 2014-04-22 20:31:52 handler_name : Video Media Handler encoder : AVC Coding Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s Metadata: creation_time : 2014-04-22 20:31:52 handler_name : Sound Media Handler Stream #0:2(eng): Subtitle: mov_text (tx3g / 0x67337874), 1280x720, 2 kb/s Metadata: creation_time : 2014-04-22 20:31:52 handler_name : Subtitle Handler Output #0, mp4, to 'Rick and Morty - Close Rick-Counters of the Rick Kind.mp4': Metadata: encoder : Lavf56.40.101 Stream #0:0(eng): Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 3367 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 30k tbc Metadata: creation_time : 2014-04-22 20:31:52 handler_name : Video Media Handler encoder : AVC Coding Stream #0:1(eng): Audio: aac ([64][0][0][0] / 0x0040), 44100 Hz, stereo, 125 kb/s Metadata: creation_time : 2014-04-22 20:31:52 handler_name : Sound Media Handler Stream mapping: Stream #0:0 -> #0:0 (copy) Stream #0:1 -> #0:1 (copy) Press [q] to stop, [?] for help [mov,mp4,m4a,3gp,3g2,mj2 @ 0x215cc00] Auto-inserting h264_mp4toannexb bitstream filter [mov,mp4,m4a,3gp,3g2,mj2 @ 0x215cc00] Auto-inserting h264_mp4toannexb bitstream filter [mov,mp4,m4a,3gp,3g2,mj2 @ 0x215cc00] Auto-inserting h264_mp4toannexb bitstream filter [mp4 @ 0x206aba0] Starting second pass: moving the moov atom to the beginning of the file frame=40328 fps=550 q=-1.0 Lsize= 567547kB time=00:22:25.64 bitrate=3455.1kbits/s video:545549kB audio:20630kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.241577% treaki@debian7:~/Videos/rick_and_morty$ # now i need to know the length of every file... treaki@debian7:~/Videos/rick_and_morty$ ffmpeg -i Rick\ and\ Morty\ -\ Close\ Rick-Counters\ of\ the\ Rick\ Kind\ Part\ 1-k-CbT8RlRVmK8QhM20IYxg-0.flv -i Rick\ and\ Morty\ -\ Close\ Rick-Counters\ of\ the\ Rick\ Kind\ Part\ 2-k-CbT8RlRVmK8QhM20IYxg-1.flv -i Rick\ and\ Morty\ -\ Close\ Rick-Counters\ of\ the\ Rick\ Kind\ Part\ 3-k-CbT8RlRVmK8QhM20IYxg-2.flv -i Rick\ and\ Morty\ -\ Close\ Rick-Counters\ of\ the\ Rick\ Kind\ Part\ 4-k-CbT8RlRVmK8QhM20IYxg-3.flv ffmpeg version 2.6.3 Copyright (c) 2000-2015 the FFmpeg developers built with gcc 4.9.2 (Debian 4.9.2-10) configuration: --prefix=/usr --extra-cflags='-g -O2 -fstack-protector-strong -Wformat -Werror=format-security ' --extra-ldflags='-Wl,-z,relro' --cc='ccache cc' --enable-shared --enable-libmp3lame --enable-gpl --enable-nonfree --enable-libvorbis --enable-pthreads --enable-libfaac --enable-libxvid --enable-postproc --enable-x11grab --enable-libgsm --enable-libtheora --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libx264 --enable-libspeex --enable-nonfree --disable-stripping --enable-libvpx --enable-libschroedinger --disable-encoder=libschroedinger --enable-version3 --enable-libopenjpeg --enable-librtmp --enable-avfilter --enable-libfreetype --enable-libvo-aacenc --disable-decoder=amrnb --enable-libvo-amrwbenc --enable-libaacplus --libdir=/usr/lib/x86_64-linux-gnu --disable-vda --enable-libbluray --enable-libcdio --enable-gnutls --enable-frei0r --enable-openssl --enable-libass --enable-libopus --enable-fontconfig --enable-libpulse --disable-mips32r2 --disable-mipsdspr1 --disable-mipsdspr2 --enable-libvidstab --enable-libzvbi --enable-avresample --disable-htmlpages --disable-podpages --enable-libutvideo --enable-libfdk-aac --enable-libx265 --enable-libiec61883 --enable-vaapi --enable-libdc1394 --disable-altivec --shlibdir=/usr/lib/x86_64-linux-gnu libavutil 54. 20.100 / 54. 31.100 libavcodec 56. 26.100 / 56. 60.100 libavformat 56. 25.101 / 56. 40.101 libavdevice 56. 4.100 / 56. 4.100 libavfilter 5. 11.102 / 5. 40.101 libavresample 2. 1. 0 / 2. 1. 0 libswscale 3. 1.101 / 3. 1.101 libswresample 1. 1.100 / 1. 2.101 libpostproc 53. 3.100 / 53. 3.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Rick and Morty - Close Rick-Counters of the Rick Kind Part 1-k-CbT8RlRVmK8QhM20IYxg-0.flv': Metadata: major_brand : f4v minor_version : 0 compatible_brands: mp42iso2isomavc1 creation_time : 2014-04-22 20:31:52 Duration: 00:06:53.59, start: 0.000000, bitrate: 3500 kb/s Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv), 1280x720 [SAR 1:1 DAR 16:9], 3367 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default) Metadata: creation_time : 2014-04-22 20:31:52 handler_name : Video Media Handler encoder : AVC Coding Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s (default) Metadata: creation_time : 2014-04-22 20:31:52 handler_name : Sound Media Handler Stream #0:2(eng): Subtitle: mov_text (tx3g / 0x67337874), 1280x720, 2 kb/s (default) Metadata: creation_time : 2014-04-22 20:31:52 handler_name : Subtitle Handler Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'Rick and Morty - Close Rick-Counters of the Rick Kind Part 2-k-CbT8RlRVmK8QhM20IYxg-1.flv': Metadata: major_brand : f4v minor_version : 0 compatible_brands: mp42iso2isomavc1 creation_time : 2014-06-24 04:38:48 Duration: 00:06:25.22, start: 0.000000, bitrate: 3504 kb/s Stream #1:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv), 1280x720 [SAR 1:1 DAR 16:9], 3370 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default) Metadata: creation_time : 2014-06-24 04:38:48 handler_name : Video Media Handler encoder : AVC Coding Stream #1:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s (default) Metadata: creation_time : 2014-06-24 04:38:48 handler_name : Sound Media Handler Stream #1:2(eng): Subtitle: mov_text (tx3g / 0x67337874), 1280x720, 3 kb/s (default) Metadata: creation_time : 2014-06-24 04:38:48 handler_name : Subtitle Handler Input #2, mov,mp4,m4a,3gp,3g2,mj2, from 'Rick and Morty - Close Rick-Counters of the Rick Kind Part 3-k-CbT8RlRVmK8QhM20IYxg-2.flv': Metadata: major_brand : f4v minor_version : 0 compatible_brands: mp42iso2isomavc1 creation_time : 2014-04-22 19:26:08 Duration: 00:05:22.57, start: 0.000000, bitrate: 3503 kb/s Stream #2:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv), 1280x720 [SAR 1:1 DAR 16:9], 3370 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default) Metadata: creation_time : 2014-04-22 19:26:08 handler_name : Video Media Handler encoder : AVC Coding Stream #2:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s (default) Metadata: creation_time : 2014-04-22 19:26:08 handler_name : Sound Media Handler Stream #2:2(eng): Subtitle: mov_text (tx3g / 0x67337874), 1280x720, 2 kb/s (default) Metadata: creation_time : 2014-04-22 19:26:08 handler_name : Subtitle Handler Input #3, mov,mp4,m4a,3gp,3g2,mj2, from 'Rick and Morty - Close Rick-Counters of the Rick Kind Part 4-k-CbT8RlRVmK8QhM20IYxg-3.flv': Metadata: major_brand : f4v minor_version : 0 compatible_brands: mp42iso2isomavc1 creation_time : 2014-04-22 18:51:56 Duration: 00:03:44.26, start: 0.000000, bitrate: 3213 kb/s Stream #3:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv), 1280x720 [SAR 1:1 DAR 16:9], 3081 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default) Metadata: creation_time : 2014-04-22 18:51:56 handler_name : Video Media Handler encoder : AVC Coding Stream #3:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s (default) Metadata: creation_time : 2014-04-22 18:51:56 handler_name : Sound Media Handler Stream #3:2(eng): Subtitle: mov_text (tx3g / 0x67337874), 1280x720, 2 kb/s (default) Metadata: creation_time : 2014-04-22 18:51:56 handler_name : Subtitle Handler At least one output file must be specified treaki@debian7:~/Videos/rick_and_morty$ #then i have to calculate the chapters beginnings and endings: treaki@debian7:~/Videos/rick_and_morty$ bc -l bc 1.06.95 Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006 Free Software Foundation, Inc. This is free software with ABSOLUTELY NO WARRANTY. For details type `warranty'. 06*60+53.59 413.59 06*60+25.22 385.22 385.22+413.59 798.81 05*60+22.57 322.57 322.57+798.81 1121.38 03*60+44.26 224.26 224.26+1121.38 1345.64 treaki@debian7:~/Videos/rick_and_morty$ #and write them into one chapter metadata file treaki@debian7:~/Videos/rick_and_morty$ cat > 'Rick and Morty - Close Rick-Counters of the Rick Kind'_chapters.txt ;FFMETADATA1 [CHAPTER] TIMEBASE=1/1000 START=0 END=413590 title=Part 1 [CHAPTER] TIMEBASE=1/1000 START=413590 END=798810 title=Part 2 [CHAPTER] TIMEBASE=1/1000 START=798810 END=1121380 title=Part 3 [CHAPTER] TIMEBASE=1/1000 START=1121380 END=1345640 title=Part 4 treaki@debian7:~/Videos/rick_and_morty$ #now i add the chapter information together with video and audio to a new file treaki@debian7:~/Videos/rick_and_morty$ ffmpeg -i Rick\ and\ Morty\ -\ Close\ Rick-Counters\ of\ the\ Rick\ Kind.mp4 -i Rick\ and\ Morty\ -\ Close\ Rick-Counters\ of\ the\ Rick\ Kind_chapters.txt -vcodec copy -acodec copy -map_chapters 1 -movflags faststart Rick\ and\ Morty\ -\ Close\ Rick-Counters\ of\ the\ Rick\ Kind_with_chapters.mp4 ffmpeg version 2.6.3 Copyright (c) 2000-2015 the FFmpeg developers built with gcc 4.9.2 (Debian 4.9.2-10) configuration: --prefix=/usr --extra-cflags='-g -O2 -fstack-protector-strong -Wformat -Werror=format-security ' --extra-ldflags='-Wl,-z,relro' --cc='ccache cc' --enable-shared --enable-libmp3lame --enable-gpl --enable-nonfree --enable-libvorbis --enable-pthreads --enable-libfaac --enable-libxvid --enable-postproc --enable-x11grab --enable-libgsm --enable-libtheora --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libx264 --enable-libspeex --enable-nonfree --disable-stripping --enable-libvpx --enable-libschroedinger --disable-encoder=libschroedinger --enable-version3 --enable-libopenjpeg --enable-librtmp --enable-avfilter --enable-libfreetype --enable-libvo-aacenc --disable-decoder=amrnb --enable-libvo-amrwbenc --enable-libaacplus --libdir=/usr/lib/x86_64-linux-gnu --disable-vda --enable-libbluray --enable-libcdio --enable-gnutls --enable-frei0r --enable-openssl --enable-libass --enable-libopus --enable-fontconfig --enable-libpulse --disable-mips32r2 --disable-mipsdspr1 --disable-mipsdspr2 --enable-libvidstab --enable-libzvbi --enable-avresample --disable-htmlpages --disable-podpages --enable-libutvideo --enable-libfdk-aac --enable-libx265 --enable-libiec61883 --enable-vaapi --enable-libdc1394 --disable-altivec --shlibdir=/usr/lib/x86_64-linux-gnu libavutil 54. 20.100 / 54. 31.100 libavcodec 56. 26.100 / 56. 60.100 libavformat 56. 25.101 / 56. 40.101 libavdevice 56. 4.100 / 56. 4.100 libavfilter 5. 11.102 / 5. 40.101 libavresample 2. 1. 0 / 2. 1. 0 libswscale 3. 1.101 / 3. 1.101 libswresample 1. 1.100 / 1. 2.101 libpostproc 53. 3.100 / 53. 3.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Rick and Morty - Close Rick-Counters of the Rick Kind.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf56.40.101 Duration: 00:22:25.64, start: 0.000000, bitrate: 3455 kb/s Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv), 1280x720 [SAR 1:1 DAR 16:9], 3321 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default) Metadata: handler_name : VideoHandler Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 125 kb/s (default) Metadata: handler_name : SoundHandler Input #1, ffmetadata, from 'Rick and Morty - Close Rick-Counters of the Rick Kind_chapters.txt': Duration: 00:22:25.64, start: 0.000000, bitrate: 0 kb/s Chapter #1:0: start 0.000000, end 413.590000 Metadata: title : Part 1 Chapter #1:1: start 413.590000, end 798.810000 Metadata: title : Part 2 Chapter #1:2: start 798.810000, end 1121.380000 Metadata: title : Part 3 Chapter #1:3: start 1121.380000, end 1345.640000 Metadata: title : Part 4 Output #0, mp4, to 'Rick and Morty - Close Rick-Counters of the Rick Kind_with_chapters.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf56.40.101 Chapter #0:0: start 0.000000, end 413.590000 Metadata: title : Part 1 Chapter #0:1: start 413.590000, end 798.810000 Metadata: title : Part 2 Chapter #0:2: start 798.810000, end 1121.380000 Metadata: title : Part 3 Chapter #0:3: start 1121.380000, end 1345.640000 Metadata: title : Part 4 Stream #0:0(eng): Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 3321 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 30k tbc (default) Metadata: handler_name : VideoHandler Stream #0:1(eng): Audio: aac ([64][0][0][0] / 0x0040), 44100 Hz, stereo, 125 kb/s (default) Metadata: handler_name : SoundHandler Stream mapping: Stream #0:0 -> #0:0 (copy) Stream #0:1 -> #0:1 (copy) Press [q] to stop, [?] for help [mp4 @ 0x258fde0] Starting second pass: moving the moov atom to the beginning of the file frame=40328 fps=857 q=-1.0 Lsize= 567547kB time=00:22:25.64 bitrate=3455.1kbits/s video:545588kB audio:20630kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.234733% treaki@debian7:~/Videos/rick_and_morty$ #now i am done and can enjoy my work treaki@debian7:~/Videos/rick_and_morty$ mpv Rick\ and\ Morty\ -\ Close\ Rick-Counters\ of\ the\ Rick\ Kind_with_chapters.mp4 Warning: mpv was compiled against a different version of ffmpeg than the shared library it is linked against. This can expose subtle ABI compatibility issues and can lead to misbehavior and crashes. Playing: Rick and Morty - Close Rick-Counters of the Rick Kind_with_chapters.mp4 (+) Video --vid=1 (*) (h264) (+) Audio --aid=1 --alang=eng (*) (aac) Subs --sid=1 --slang=eng (mov_text) AO: [pulse] 44100Hz stereo 2ch float VO: [opengl] 1280x720 yuv420p AV: 00:00:00 / 00:22:25 (0%) A-V: 0.000 [vo/opengl/x11] Disabling screensaver failed. AV: 00:00:04 / 00:22:25 (0%) A-V: 0.000 Exiting... (Quit) treaki@debian7:~/Videos/rick_and_morty$ #and of cause delete the temporary file treaki@debian7:~/Videos/rick_and_morty$ rm Rick\ and\ Morty\ -\ Close\ Rick-Counters\ of\ the\ Rick\ Kind.mp4 treaki@debian7:~/Videos/rick_and_morty$ ```
Author
Owner

@yan12125 commented on GitHub (Feb 17, 2016):

Related to #2723, #2844 and more.

@yan12125 commented on GitHub (Feb 17, 2016): Related to #2723, #2844 and more.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/youtube-dl-ytdl-org#6945
No description provided.