[FFmpeg-user] Using ffmpeg to remove commercials from video file

Jesper Lund Stocholm 4a4553504552 at gmail.com
Tue Aug 20 12:13:41 CEST 2013


Hi Werner,


2013/8/20 Werner Robitza <werner.robitza at gmail.com>
>
>
> Note that -ss specifies the start time and -to the end time.
> You cannot start at 22:29 and end at 18:58. Unless you expect ffmpeg
> to travel back in time :)
>
> If you want it to start at 22:29 and encode for 18 minutes and 58
> seconds, you need -t, not -to.
>
>
Yes, I would think that as well. The thing is just that if I use the
timestamp instead of the duration, e.g.


ffmpeg -ss "00:22:29.500" -i "movie.m4v" -to "00:41:27" -c:v copy -c:a copy
"output.pt2_to_4127.m4v"
ffmpeg -ss "00:22:29.500" -i "movie.m4v" -t "00:41:27" -c:v copy -c:a copy
"output.pt2_t_4127.m4v"

ffmpeg produces exactly identical files and console output (apart from the
actual copying of stream that vary a little bit (I assume that is because
of my machine doing other stuff as well)).

Both files are 41:27 minutes in length.


-- 
Jesper Lund Stocholm
www.idippedut.dk
SC34/WG4 http://www.itscj.ipsj.or.jp/sc34/wg4/
-------------- next part --------------
?
C:\Users\jst\Downloads\ffmpeg-20130809-git-3b2e99f-win64-static\ffmpeg-20130809-
git-3b2e99f-win64-static\bin>"ffmpeg commercial removal.bat"

C:\Users\jst\Downloads\ffmpeg-20130809-git-3b2e99f-win64-static\ffmpeg-20130809-
git-3b2e99f-win64-static\bin>ffmpeg -ss "00:22:29.500" -i "The Princess and the
Frog (2009).m4v" -t "00:41:27" -c:v copy -c:a copy "c:\users\jst\desktop\The Pri
ncess and the Frog (2009).pt2_t_4127.m4v"
ffmpeg version N-55393-g3b2e99f Copyright (c) 2000-2013 the FFmpeg developers
  built on Aug  8 2013 21:37:55 with gcc 4.7.3 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetyp
e --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --ena
ble-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-l
ibopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libsp
eex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo-
amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --
enable-libxvid --enable-zlib
  libavutil      52. 41.100 / 52. 41.100
  libavcodec     55. 24.100 / 55. 24.100
  libavformat    55. 13.102 / 55. 13.102
  libavdevice    55.  3.100 / 55.  3.100
  libavfilter     3. 82.100 /  3. 82.100
  libswscale      2.  4.100 /  2.  4.100
  libswresample   0. 17.103 /  0. 17.103
  libpostproc    52.  3.100 / 52.  3.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 00000000028fa880] stream 0, timescale not set
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'The Princess and the Frog (2009).m4v':
  Metadata:
    major_brand     : M4VH
    minor_version   : 1
    compatible_brands: M4VHM4A mp42isom
    creation_time   : 2012-11-18 22:23:57
    title           : Prinsessen og Fr?©en
    description     : 2009, Animation - (The Princess and the Frog) Amerikansk a
nimationsfilm fra 2009. Den smukke prinsesse Tiana m?©der en fr?©, som i virkeli
gheden er en prins, der er desperat for at blive forvandlet til et menneske igen
. Et sk?ªbnesvangert kys tryller ogs?
    synopsis        : 2009, Animation - (The Princess and the Frog) Amerikansk a
nimationsfilm fra 2009. Den smukke prinsesse Tiana m?©der en fr?©, som i virkeli
gheden er en prins, der er desperat for at blive forvandlet til et menneske igen
. Et sk?ªbnesvangert kys tryller ogs?
    comment         : 2009, Animation - (The Princess and the Frog) Amerikansk a
nimationsfilm fra 2009. Den smukke prinsesse Tiana m?©der en fr?©, som i virkeli
gheden er en prins, der er desperat for at blive forvandlet til et menneske igen
. Et sk?ªbnesvangert kys tryller ogs?
    media_type      : 0
    network         : Kanal 5 DK
    genre           : TV Shows
    date            : 2009-01-01
  Duration: 02:01:39.36, start: 0.000000, bitrate: 5089 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720,
 4953 kb/s, 25 fps, 25 tbr, 2500 tbn, 5k tbc
    Metadata:
      creation_time   : 2012-11-18 22:23:58
      handler_name    : Apple Video Media Handler
    Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 12
5 kb/s
    Metadata:
      creation_time   : 2012-11-18 22:24:00
      handler_name    : Apple Sound Media Handler
    Stream #0:2: Video: mjpeg, yuvj420p, 512x748 [SAR 1:1 DAR 128:187], 90k tbr,
 90k tbn, 90k tbc
Output #0, ipod, to 'c:\users\jst\desktop\The Princess and the Frog (2009).pt2_t
_4127.m4v':
  Metadata:
    major_brand     : M4VH
    minor_version   : 1
    compatible_brands: M4VHM4A mp42isom
    date            : 2009-01-01
    title           : Prinsessen og Fr?©en
    description     : 2009, Animation - (The Princess and the Frog) Amerikansk a
nimationsfilm fra 2009. Den smukke prinsesse Tiana m?©der en fr?©, som i virkeli
gheden er en prins, der er desperat for at blive forvandlet til et menneske igen
. Et sk?ªbnesvangert kys tryller ogs?
    synopsis        : 2009, Animation - (The Princess and the Frog) Amerikansk a
nimationsfilm fra 2009. Den smukke prinsesse Tiana m?©der en fr?©, som i virkeli
gheden er en prins, der er desperat for at blive forvandlet til et menneske igen
. Et sk?ªbnesvangert kys tryller ogs?
    comment         : 2009, Animation - (The Princess and the Frog) Amerikansk a
nimationsfilm fra 2009. Den smukke prinsesse Tiana m?©der en fr?©, som i virkeli
gheden er en prins, der er desperat for at blive forvandlet til et menneske igen
. Et sk?ªbnesvangert kys tryller ogs?
    media_type      : 0
    network         : Kanal 5 DK
    genre           : TV Shows
    encoder         : Lavf55.13.102
    Stream #0:0(eng): Video: h264 (avc1 / 0x31637661), yuv420p, 1280x720, q=2-31
, 4953 kb/s, 25 fps, 10k tbn, 2500 tbc
    Metadata:
      creation_time   : 2012-11-18 22:23:58
      handler_name    : Apple Video Media Handler
    Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, 125 kb/s

    Metadata:
      creation_time   : 2012-11-18 22:24:00
      handler_name    : Apple Sound Media Handler
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame= 6411 fps=0.0 q=-1.0 size=  162923kB time=00:04:16.64 bitrate=5200.5kbits/
frame=13091 fps=13090 q=-1.0 size=  325306kB time=00:08:44.42 bitrate=5081.6kbit
frame=19554 fps=13035 q=-1.0 size=  448192kB time=00:13:02.98 bitrate=4689.2kbit
frame=24216 fps=11482 q=-1.0 size=  569746kB time=00:16:09.34 bitrate=4814.9kbit
frame=29395 fps=11266 q=-1.0 size=  726535kB time=00:19:36.19 bitrate=5060.2kbit
frame=35030 fps=11267 q=-1.0 size=  874573kB time=00:23:21.98 bitrate=5110.2kbit
frame=35348 fps=9398 q=-1.0 size=  884548kB time=00:23:34.29 bitrate=5123.5kbits
frame=36056 fps=8309 q=-1.0 size=  902279kB time=00:24:02.94 bitrate=5122.5kbits
frame=36392 fps=7436 q=-1.0 size=  910156kB time=00:24:16.26 bitrate=5120.0kbits
frame=36700 fps=6631 q=-1.0 size=  918405kB time=00:24:28.54 bitrate=5123.1kbits
frame=38320 fps=6272 q=-1.0 size=  955597kB time=00:25:33.06 bitrate=5106.3kbits
frame=39125 fps=5837 q=-1.0 size=  973841kB time=00:26:05.82 bitrate=5094.9kbits
frame=41898 fps=5779 q=-1.0 size= 1050695kB time=00:27:56.44 bitrate=5134.3kbits
frame=42390 fps=5466 q=-1.0 size= 1063220kB time=00:28:16.38 bitrate=5134.4kbits
frame=43646 fps=5248 q=-1.0 size= 1091937kB time=00:29:06.05 bitrate=5123.1kbits
frame=45383 fps=5108 q=-1.0 size= 1134075kB time=00:30:15.68 bitrate=5116.7kbits
frame=47973 fps=5081 q=-1.0 size= 1196073kB time=00:31:59.12 bitrate=5105.6kbits
frame=48427 fps=4828 q=-1.0 size= 1207055kB time=00:32:17.54 bitrate=5103.5kbits
frame=49511 fps=4677 q=-1.0 size= 1234372kB time=00:33:00.54 bitrate=5105.6kbits
frame=50433 fps=4544 q=-1.0 size= 1256989kB time=00:33:37.92 bitrate=5102.9kbits
frame=52197 fps=4475 q=-1.0 size= 1297157kB time=00:34:48.06 bitrate=5089.1kbits
frame=54015 fps=4440 q=-1.0 size= 1336514kB time=00:36:01.28 bitrate=5065.8kbits
frame=55272 fps=4342 q=-1.0 size= 1363888kB time=00:36:51.46 bitrate=5052.3kbits
frame=56111 fps=4242 q=-1.0 size= 1382921kB time=00:37:24.78 bitrate=5046.8kbits
frame=59485 fps=4333 q=-1.0 size= 1471297kB time=00:39:39.90 bitrate=5064.4kbits
frame=60391 fps=4239 q=-1.0 size= 1492583kB time=00:40:16.26 bitrate=5060.4kbits
frame=60433 fps=4069 q=-1.0 size= 1494021kB time=00:40:17.79 bitrate=5062.1kbits
frame=60574 fps=3945 q=-1.0 size= 1496604kB time=00:40:23.89 bitrate=5058.0kbits
frame=60647 fps=3813 q=-1.0 size= 1497990kB time=00:40:26.50 bitrate=5057.3kbits
frame=60732 fps=3682 q=-1.0 size= 1499395kB time=00:40:29.57 bitrate=5055.6kbits
frame=60768 fps=3567 q=-1.0 size= 1500439kB time=00:40:31.10 bitrate=5056.0kbits
frame=60829 fps=3449 q=-1.0 size= 1502157kB time=00:40:33.66 bitrate=5056.4kbits
frame=61840 fps=3404 q=-1.0 size= 1527772kB time=00:41:14.11 bitrate=5058.6kbits
frame=62177 fps=3396 q=-1.0 Lsize= 1535678kB time=00:41:27.00 bitrate=5058.4kbit
s/s
video:1495633kB audio:38193kB subtitle:0 global headers:0kB muxing overhead 0.12
0815%
-------------- next part --------------
?
C:\Users\jst\Downloads\ffmpeg-20130809-git-3b2e99f-win64-static\ffmpeg-20130809-
git-3b2e99f-win64-static\bin>"ffmpeg commercial removal.bat"

C:\Users\jst\Downloads\ffmpeg-20130809-git-3b2e99f-win64-static\ffmpeg-20130809-
git-3b2e99f-win64-static\bin>ffmpeg -ss "00:22:29.500" -i "The Princess and the
Frog (2009).m4v" -to "00:41:27" -c:v copy -c:a copy "c:\users\jst\desktop\The Pr
incess and the Frog (2009).pt2_to_4127.m4v"
ffmpeg version N-55393-g3b2e99f Copyright (c) 2000-2013 the FFmpeg developers
  built on Aug  8 2013 21:37:55 with gcc 4.7.3 (GCC)
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-av
isynth --enable-bzlib --enable-fontconfig --enable-frei0r --enable-gnutls --enab
le-iconv --enable-libass --enable-libbluray --enable-libcaca --enable-libfreetyp
e --enable-libgsm --enable-libilbc --enable-libmodplug --enable-libmp3lame --ena
ble-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-l
ibopus --enable-librtmp --enable-libschroedinger --enable-libsoxr --enable-libsp
eex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc --enable-libvo-
amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --
enable-libxvid --enable-zlib
  libavutil      52. 41.100 / 52. 41.100
  libavcodec     55. 24.100 / 55. 24.100
  libavformat    55. 13.102 / 55. 13.102
  libavdevice    55.  3.100 / 55.  3.100
  libavfilter     3. 82.100 /  3. 82.100
  libswscale      2.  4.100 /  2.  4.100
  libswresample   0. 17.103 /  0. 17.103
  libpostproc    52.  3.100 / 52.  3.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 000000000036a880] stream 0, timescale not set
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'The Princess and the Frog (2009).m4v':
  Metadata:
    major_brand     : M4VH
    minor_version   : 1
    compatible_brands: M4VHM4A mp42isom
    creation_time   : 2012-11-18 22:23:57
    title           : Prinsessen og Fr?©en
    description     : 2009, Animation - (The Princess and the Frog) Amerikansk a
nimationsfilm fra 2009. Den smukke prinsesse Tiana m?©der en fr?©, som i virkeli
gheden er en prins, der er desperat for at blive forvandlet til et menneske igen
. Et sk?ªbnesvangert kys tryller ogs?
    synopsis        : 2009, Animation - (The Princess and the Frog) Amerikansk a
nimationsfilm fra 2009. Den smukke prinsesse Tiana m?©der en fr?©, som i virkeli
gheden er en prins, der er desperat for at blive forvandlet til et menneske igen
. Et sk?ªbnesvangert kys tryller ogs?
    comment         : 2009, Animation - (The Princess and the Frog) Amerikansk a
nimationsfilm fra 2009. Den smukke prinsesse Tiana m?©der en fr?©, som i virkeli
gheden er en prins, der er desperat for at blive forvandlet til et menneske igen
. Et sk?ªbnesvangert kys tryller ogs?
    media_type      : 0
    network         : Kanal 5 DK
    genre           : TV Shows
    date            : 2009-01-01
  Duration: 02:01:39.36, start: 0.000000, bitrate: 5089 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1280x720,
 4953 kb/s, 25 fps, 25 tbr, 2500 tbn, 5k tbc
    Metadata:
      creation_time   : 2012-11-18 22:23:58
      handler_name    : Apple Video Media Handler
    Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 12
5 kb/s
    Metadata:
      creation_time   : 2012-11-18 22:24:00
      handler_name    : Apple Sound Media Handler
    Stream #0:2: Video: mjpeg, yuvj420p, 512x748 [SAR 1:1 DAR 128:187], 90k tbr,
 90k tbn, 90k tbc
Output #0, ipod, to 'c:\users\jst\desktop\The Princess and the Frog (2009).pt2_t
o_4127.m4v':
  Metadata:
    major_brand     : M4VH
    minor_version   : 1
    compatible_brands: M4VHM4A mp42isom
    date            : 2009-01-01
    title           : Prinsessen og Fr?©en
    description     : 2009, Animation - (The Princess and the Frog) Amerikansk a
nimationsfilm fra 2009. Den smukke prinsesse Tiana m?©der en fr?©, som i virkeli
gheden er en prins, der er desperat for at blive forvandlet til et menneske igen
. Et sk?ªbnesvangert kys tryller ogs?
    synopsis        : 2009, Animation - (The Princess and the Frog) Amerikansk a
nimationsfilm fra 2009. Den smukke prinsesse Tiana m?©der en fr?©, som i virkeli
gheden er en prins, der er desperat for at blive forvandlet til et menneske igen
. Et sk?ªbnesvangert kys tryller ogs?
    comment         : 2009, Animation - (The Princess and the Frog) Amerikansk a
nimationsfilm fra 2009. Den smukke prinsesse Tiana m?©der en fr?©, som i virkeli
gheden er en prins, der er desperat for at blive forvandlet til et menneske igen
. Et sk?ªbnesvangert kys tryller ogs?
    media_type      : 0
    network         : Kanal 5 DK
    genre           : TV Shows
    encoder         : Lavf55.13.102
    Stream #0:0(eng): Video: h264 (avc1 / 0x31637661), yuv420p, 1280x720, q=2-31
, 4953 kb/s, 25 fps, 10k tbn, 2500 tbc
    Metadata:
      creation_time   : 2012-11-18 22:23:58
      handler_name    : Apple Video Media Handler
    Stream #0:1(eng): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, 125 kb/s

    Metadata:
      creation_time   : 2012-11-18 22:24:00
      handler_name    : Apple Sound Media Handler
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame= 6261 fps=0.0 q=-1.0 size=  159049kB time=00:04:10.50 bitrate=5201.3kbits/
frame=12977 fps=12976 q=-1.0 size=  322465kB time=00:08:39.81 bitrate=5081.9kbit
frame=19635 fps=13089 q=-1.0 size=  449628kB time=00:13:05.54 bitrate=4688.9kbit
frame=24978 fps=12488 q=-1.0 size=  601562kB time=00:16:39.55 bitrate=4930.2kbit
frame=30527 fps=12210 q=-1.0 size=  761213kB time=00:20:21.76 bitrate=5104.0kbit
frame=36336 fps=12099 q=-1.0 size=  908624kB time=00:24:13.70 bitrate=5120.3kbit
frame=36941 fps=10545 q=-1.0 size=  924700kB time=00:24:38.27 bitrate=5124.3kbit
frame=37496 fps=9362 q=-1.0 size=  940516kB time=00:25:00.29 bitrate=5135.5kbits
frame=38513 fps=8548 q=-1.0 size=  958363kB time=00:25:41.25 bitrate=5093.8kbits
frame=39195 fps=7778 q=-1.0 size=  975467kB time=00:26:08.38 bitrate=5095.1kbits
frame=39957 fps=7176 q=-1.0 size=  997110kB time=00:26:38.59 bitrate=5109.7kbits
frame=40548 fps=6664 q=-1.0 size= 1013557kB time=00:27:02.14 bitrate=5118.6kbits
frame=41361 fps=6282 q=-1.0 size= 1039396kB time=00:27:34.91 bitrate=5145.1kbits
frame=42169 fps=5931 q=-1.0 size= 1057557kB time=00:28:07.17 bitrate=5134.9kbits
frame=43198 fps=5676 q=-1.0 size= 1081768kB time=00:28:48.17 bitrate=5127.9kbits
frame=43867 fps=5406 q=-1.0 size= 1097500kB time=00:29:15.26 bitrate=5122.1kbits
frame=44644 fps=5169 q=-1.0 size= 1115915kB time=00:29:46.50 bitrate=5117.0kbits
frame=45598 fps=4972 q=-1.0 size= 1138442kB time=00:30:24.38 bitrate=5111.9kbits
frame=46618 fps=4814 q=-1.0 size= 1161309kB time=00:31:05.34 bitrate=5100.1kbits
frame=47728 fps=4639 q=-1.0 size= 1189348kB time=00:31:49.89 bitrate=5101.4kbits
frame=48888 fps=4531 q=-1.0 size= 1218503kB time=00:32:36.46 bitrate=5102.1kbits
frame=49611 fps=4393 q=-1.0 size= 1236475kB time=00:33:04.64 bitrate=5103.8kbits
frame=50476 fps=4273 q=-1.0 size= 1257933kB time=00:33:39.97 bitrate=5101.6kbits
frame=51680 fps=4169 q=-1.0 size= 1284564kB time=00:34:27.58 bitrate=5089.6kbits
frame=52331 fps=4058 q=-1.0 size= 1300988kB time=00:34:53.70 bitrate=5090.4kbits
frame=53084 fps=3963 q=-1.0 size= 1317921kB time=00:35:23.90 bitrate=5083.3kbits
frame=53911 fps=3860 q=-1.0 size= 1333700kB time=00:35:56.67 bitrate=5066.0kbits
frame=54732 fps=3780 q=-1.0 size= 1352161kB time=00:36:29.95 bitrate=5058.0kbits
frame=56054 fps=3739 q=-1.0 size= 1381878kB time=00:37:22.69 bitrate=5047.7kbits
frame=57303 fps=3699 q=-1.0 size= 1404381kB time=00:38:12.86 bitrate=5017.6kbits
frame=57906 fps=3609 q=-1.0 size= 1422798kB time=00:38:36.93 bitrate=5030.6kbits
frame=58298 fps=3510 q=-1.0 size= 1435109kB time=00:38:52.31 bitrate=5040.7kbits
frame=58728 fps=3432 q=-1.0 size= 1448444kB time=00:39:09.70 bitrate=5049.9kbits
frame=59184 fps=3359 q=-1.0 size= 1461727kB time=00:39:27.62 bitrate=5057.6kbits
frame=60297 fps=3308 q=-1.0 size= 1489368kB time=00:40:12.16 bitrate=5058.1kbits
frame=61460 fps=3281 q=-1.0 size= 1518076kB time=00:40:58.75 bitrate=5057.9kbits
frame=62177 fps=3252 q=-1.0 Lsize= 1535678kB time=00:41:27.00 bitrate=5058.4kbit
s/s
video:1495633kB audio:38193kB subtitle:0 global headers:0kB muxing overhead 0.12
0815%


More information about the ffmpeg-user mailing list