You are not logged in.

#1 2018-05-12 15:42:01

makh
Member
Registered: 2011-10-10
Posts: 127

(SOLVED) ffmpeg - partial video conversion not working

Hi

I used the following:

ffmpeg -i 2018-04-30_Lecture.avi -ss 0:0:0 -t 0:14:00 -vcodec copy -acodec copy  2018-04-30_Lecture_p01.avi

...but I only get the few seconds in the output file.

Am I using the command, wrongly?

Thankyou

Last edited by makh (2018-05-22 02:15:28)


OS:  Arch  &  Debian
System: HP Probook 440 G2
WM: Openbox

Offline

#2 2018-05-12 17:38:36

teckk
Member
Registered: 2013-02-21
Posts: 273

Re: (SOLVED) ffmpeg - partial video conversion not working

What are you trying to achieve? The first 14 min of the Lecture?

ffmpeg -t 00:14:00 -i Infile.avi -c:a copy -c:v copy Out.avi

Edit: Sorry for the edits, I'll get my fingers working.

Last edited by teckk (2018-05-12 17:40:04)

Offline

#3 2018-05-12 18:17:41

makh
Member
Registered: 2011-10-10
Posts: 127

Re: (SOLVED) ffmpeg - partial video conversion not working

Hi

Yes first 14 minutes only. I got it running ok in Debian, but in arch ffmpeg, I am having this problem.

Thankyou


OS:  Arch  &  Debian
System: HP Probook 440 G2
WM: Openbox

Offline

#4 2018-05-14 19:27:50

DrZaius
Member
Registered: 2008-01-02
Posts: 185

Re: (SOLVED) ffmpeg - partial video conversion not working

makh wrote:

...but I only get the few seconds in the output file.

Show the complete console output from your command. What are you using to play the output?


Damned dirty ape.

Offline

#5 2018-05-14 21:28:30

newbie1962
Member
From: italy
Registered: 2012-07-24
Posts: 111

Re: (SOLVED) ffmpeg - partial video conversion not working

try like this

-ss 00:00:00 -t 00:14:00 -acodec copy -vcodec copy output.avi

hp-envy dv7

Offline

#6 2018-05-14 21:39:51

DrZaius
Member
Registered: 2008-01-02
Posts: 185

Re: (SOLVED) ffmpeg - partial video conversion not working

No need for "-ss 00:00:00". Also, "-c copy" can be used instead of "-acodec copy -vcodec copy".


Damned dirty ape.

Offline

#7 2018-05-14 21:55:08

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 19,078
Website

Re: (SOLVED) ffmpeg - partial video conversion not working

Can we stay on point here.  This seems to be the the only relevant post so far and we're still waiting for the information:

DrZaius wrote:

Show the complete console output from your command. What are you using to play the output?

Yes, there are many optional flags and simpler formats for entering them, but all of the alternatives up for comparison so far are valid and should result in the desired outcome.  So the cause of the problem is not whether one or two zeros were used, or a verbose copy flag, or an explicit start time.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#8 2018-05-15 14:02:25

makh
Member
Registered: 2011-10-10
Posts: 127

Re: (SOLVED) ffmpeg - partial video conversion not working

Hi

$ ffmpeg -i file_1.avi -ss 0:0:0 -t 0:14:00 -vcodec copy -acodec copy  file_2.avi
ffmpeg version 3.4.2 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 7.3.0 (GCC)
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-avisynth --enable-avresample --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libass --enable-libbluray --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-shared --enable-version3 --enable-omx
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
Invalid return value 0 for stream protocol
    Last message repeated 1 times
Input #0, avi, from 'file_1.avi':
  Metadata:
    encoder         : Lavf57.56.101
  Duration: 00:30:41.02, start: 0.000000, bitrate: 337 kb/s
    Stream #0:0: Video: mpeg4 (Simple Profile) (FMP4 / 0x34504D46), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 199 kb/s, 10 fps, 10 tbr, 10 tbn, 10 tbc
    Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 48000 Hz, stereo, s16p, 128 kb/s
Output #0, avi, to 'file_2.avi':
  Metadata:
    ISFT            : Lavf57.83.100
    Stream #0:0: Video: mpeg4 (Simple Profile) (FMP4 / 0x34504D46), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 199 kb/s, 10 fps, 10 tbr, 10 tbn, 10 tbc
    Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 48000 Hz, stereo, s16p, 128 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame=    1 fps=0.0 q=-1.0 Lsize=      41kB time=00:00:01.15 bitrate= 289.6kbits/s speed=3.6e+03x    
video:11kB audio:18kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 36.952023%

$ du -hs *
75M	file_1.avi
44K	file_2.avi

I use vlc.

Thankyou

Last edited by makh (2018-05-15 14:03:55)


OS:  Arch  &  Debian
System: HP Probook 440 G2
WM: Openbox

Offline

#9 2018-05-15 20:11:15

newbie1962
Member
From: italy
Registered: 2012-07-24
Posts: 111

Re: (SOLVED) ffmpeg - partial video conversion not working

[donna@rumma-pc avi cowon glastonbury c'è già intero concerto]$ ffmpeg -i '/run/media/don/Windows 8.1/recupero-cowon/avi cowon glastonbury c'\''è già intero concerto/The Rolling Stones - Glastonbury 2013 Full Concert 2h11m40s.avi' -t 00:14:00 -acodec copy -vcodec copy output.avi
ffmpeg version 4.0 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 8.1.0 (GCC)
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-avresample --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libass --enable-libbluray --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-nvenc --enable-omx --enable-shared --enable-version3
  libavutil      56. 14.100 / 56. 14.100
  libavcodec     58. 18.100 / 58. 18.100
  libavformat    58. 12.100 / 58. 12.100
  libavdevice    58.  3.100 / 58.  3.100
  libavfilter     7. 16.100 /  7. 16.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  1.100 /  5.  1.100
  libswresample   3.  1.100 /  3.  1.100
  libpostproc    55.  1.100 / 55.  1.100
Input #0, avi, from '/run/media/don/Windows 8.1/recupero-cowon/avi cowon glastonbury c'è già intero concerto/The Rolling Stones - Glastonbury 2013 Full Concert 2h11m40s.avi':
  Metadata:
    comment         : www.freemake.com
    encoder         : Lavf55.13.102
  Duration: 02:11:42.74, start: 0.000000, bitrate: 1039 kb/s
    Stream #0:0: Video: mpeg4 (Advanced Simple Profile) (XVID / 0x44495658), yuv420p, 480x280 [SAR 7:9 DAR 4:3], 897 kb/s, 29.97 fps, 29.97 tbr, 29.97 tbn, 29.97 tbc
    Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 48000 Hz, stereo, fltp, 128 kb/s
Output #0, avi, to 'output.avi':
  Metadata:
    ICMT            : www.freemake.com
    ISFT            : Lavf58.12.100
    Stream #0:0: Video: mpeg4 (Advanced Simple Profile) (XVID / 0x44495658), yuv420p, 480x280 [SAR 7:9 DAR 4:3], q=2-31, 897 kb/s, 29.97 fps, 29.97 tbr, 29.97 tbn, 29.97 tbc
    Stream #0:1: Audio: mp3 (U[0][0][0] / 0x0055), 48000 Hz, stereo, fltp, 128 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
[avi @ 0x55e8aaa10340] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly
frame= 3204 fps=0.0 q=-1.0 size=   21258kB time=00:02:08.29 bitrate=1357.4kbits/frame= 5957 fps=5931 q=-1.0 size=   40202kB time=00:03:58.43 bitrate=1381.2kbitsframe= 9131 fps=6070 q=-1.0 size=   60170kB time=00:06:05.39 bitrate=1349.0kbitsframe=12415 fps=6186 q=-1.0 size=   81418kB time=00:08:16.73 bitrate=1342.7kbitsframe=15795 fps=6301 q=-1.0 size=  100874kB time=00:10:31.94 bitrate=1307.6kbitsframe=19028 fps=6328 q=-1.0 size=  121098kB time=00:12:41.26 bitrate=1303.1kbitsframe=20996 fps=6289 q=-1.0 Lsize=  133078kB time=00:13:59.97 bitrate=1297.9kbits/s speed= 252x    
video:118518kB audio:13125kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.089878%
[donna@rumma-pc avi cowon glastonbury c'è già intero concerto]$ 
[donna@rumma-pc avi cowon glastonbury c'è già intero concerto]$ mpv '/run/media/don/Windows 8.1/recupero-cowon/avi cowon glastonbury \c'è già intero concerto/output.avi' 
Playing: /run/media/don/Windows 8.1/recupero-cowon/avi cowon glastonbury c'è già intero concerto/output.avi
[ffmpeg/video] mpeg4: Failed to parse extradata
 (+) Video --vid=1 (mpeg4 480x280 29.970fps)
 (+) Audio --aid=1 (mp3 2ch 48000Hz)
File tags:
 Comment: www.freemake.com
AO: [pulse] 48000Hz stereo 2ch float
VO: [gpu] 480x280 => 480x360 yuv420p
AV: 00:00:33 / 00:14:00 (3%) A-V:  0.000 Cache: 806s+144MB


Exiting... (Quit)
[donna@rumma-pc avi cowon glastonbury c'è già intero concerto]$ 

I'm not a great expert but my command seems to work, sorry for the trouble.
Regards

Last edited by newbie1962 (2018-05-15 20:12:05)


hp-envy dv7

Offline

#10 2018-05-15 21:22:56

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 19,078
Website

Re: (SOLVED) ffmpeg - partial video conversion not working

newbie, you have different files on a different computer.  I'd bet makh's command would work on your files too.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#11 2018-05-15 21:43:04

loqs
Member
Registered: 2014-03-06
Posts: 4,521

Re: (SOLVED) ffmpeg - partial video conversion not working

@Trilby possibly an ffmpeg stream parsing issue causing it misdetect stream length?

Offline

#12 2018-05-16 01:30:08

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 19,078
Website

Re: (SOLVED) ffmpeg - partial video conversion not working

It's possibly many things.  I'm just amazed at how much noise there is in this thread about different formats of parameters and irrelevant comparisons.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#13 2018-05-16 19:53:11

DrZaius
Member
Registered: 2008-01-02
Posts: 185

Re: (SOLVED) ffmpeg - partial video conversion not working

makh wrote:

Hi

$ ffmpeg -i file_1.avi -ss 0:0:0 -t 0:14:00 -vcodec copy -acodec copy  file_2.avi

Normally I would expect your command to work, but this seems like a problematic or broken file or a bug. Is this the only file you have that shows this behavior? What created the file? Please provide a link to file_1.avi (or any other file that allows us to duplicate this issue) if you are willing to share it. Without the file it will be difficult to determine the cause of the problem, and if it is a bug in ffmpeg it will be appreciated it if you share the input file so the issue can be fixed.

If you're unable to share the file please at least update your ffmpeg package and try again. Even better if you could test a build from the current git master branch:

sudo pacman -S nasm
curl -O https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2
tar xvf ffmpeg-snapshot.tar.bz2
cd ffmpeg
./configure
make -j4 ffmpeg
./ffmpeg -i ~/file_1.avi -t 0:14:00 -c copy ~/file_2.avi

Last edited by DrZaius (2018-05-16 20:00:29)


Damned dirty ape.

Offline

#14 2018-05-17 19:22:39

makh
Member
Registered: 2011-10-10
Posts: 127

Re: (SOLVED) ffmpeg - partial video conversion not working

DrZaius wrote:
makh wrote:

...

Hi
Sir! I am using:

ffmpeg -f alsa -i default -f v4l2 -s 1024x768 -i /dev/video0 output.avi

to create the file, using my webcam and mic of laptop.

2. I did wrote before: the command works in debian stable, so I dont think getting another ffmpeg is the matter.

3. I will try to share a smaller file. Please wait.

Thankyou


OS:  Arch  &  Debian
System: HP Probook 440 G2
WM: Openbox

Offline

#15 2018-05-17 19:26:03

loqs
Member
Registered: 2014-03-06
Posts: 4,521

Re: (SOLVED) ffmpeg - partial video conversion not working

makh if you do not believe ffmpeg is the cause what are you suggesting is the cause?
ffmpeg as provided by debian is a different version built with a different configuration and linked to different libraries both in terms of library versions and actual libraries used.
Edit:
If you generate a file using

ffmpeg -f lavfi -i yuvtestsrc -t 1:00 output.ext

can you then extract a portion of that file successfully?

Last edited by loqs (2018-05-17 19:46:43)

Offline

#16 2018-05-18 19:09:44

makh
Member
Registered: 2011-10-10
Posts: 127

Re: (SOLVED) ffmpeg - partial video conversion not working

loqs wrote:

makh if you do not believe ffmpeg is the cause what are you suggesting is the cause? ...

Hi
Sir! I think that ffmpeg is the cause as it is not working, as it is in debian.

I do not understand the other part, you wrote.

Thankyou


OS:  Arch  &  Debian
System: HP Probook 440 G2
WM: Openbox

Offline

#17 2018-05-18 20:28:47

loqs
Member
Registered: 2014-03-06
Posts: 4,521

Re: (SOLVED) ffmpeg - partial video conversion not working

ffmpeg -f lavfi -i yuvtestsrc -t 1:00 output.avi

should create a video file 1 minute long.

ffmpeg -i output.avi -ss 0:0:0 -t 0:0:30 -vcodec copy -acodec copy  output_2.avi

Does the above generate output_2.avi containing 30 seconds of video from the first video file?

Offline

#18 2018-05-18 20:44:20

DrZaius
Member
Registered: 2008-01-02
Posts: 185

Re: (SOLVED) ffmpeg - partial video conversion not working

makh wrote:

2. I did wrote before: the command works in debian stable, so I dont think getting another ffmpeg is the matter.

If it works in an older version of ffmpeg but not a newer one then it may be a regression which is important to fix. I could test with a sample file. Without a sample file to test I can't do much other than suggesting you try a recent ffmpeg as described in comment #13. Currently it is unknown if the problem is from the creation of the file from the webcam, or in the demuxing of the file during the attempt to cut it. It is also unknown if a newer version of ffmpeg successfully creates the file from the webcam and/or properly cuts the existing broken one.

loqs wrote:

Does the above generate output_2.avi containing 30 seconds of video from the first video file?

Generating and testing a synthetic file is likely a distraction. I suspect the issue will not be reproducible with such an input. A sample file will be more helpful.

Last edited by DrZaius (2018-05-18 20:47:53)


Damned dirty ape.

Offline

#19 2018-05-19 16:43:52

teckk
Member
Registered: 2013-02-21
Posts: 273

Re: (SOLVED) ffmpeg - partial video conversion not working

See what your cam supports

ffmpeg -f video4linux2 -list_formats all -i /dev/video0

Stream #0:0: Video: mpeg4 (Simple Profile) (FMP4 / 0x34504D46), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 199 kb/s, 10 fps, 10 tbr, 10 tbn, 10 tbc

You may want to encode the video into another format and see if that works better.

Try a few tests
Start with just the video

ffmpeg -f v4l2 -s 1024x768 -i /dev/video0 -c:v libx264 -b:v 300k out.mp4

or

ffmpeg -f v4l2 -s 1024x768 -i /dev/video0 -c:v libx264 -crf 22 -preset fast out.mp4
ffmpeg -t 00:00:30 -i out.mp4 -c:a copy -c:v copy short_sample.mp4

Does that allow you to do what you want?

Offline

#20 2018-05-21 21:51:53

makh
Member
Registered: 2011-10-10
Posts: 127

Re: (SOLVED) ffmpeg - partial video conversion not working

loqs wrote:
ffmpeg -f lavfi -i yuvtestsrc -t 1:00 output.avi

should create a video file 1 minute long.

ffmpeg -i output.avi -ss 0:0:0 -t 0:0:30 -vcodec copy -acodec copy  output_2.avi

Does the above generate output_2.avi containing 30 seconds of video from the first video file?

Hi
Yes.


OS:  Arch  &  Debian
System: HP Probook 440 G2
WM: Openbox

Offline

#21 2018-05-21 23:35:33

makh
Member
Registered: 2011-10-10
Posts: 127

Re: (SOLVED) ffmpeg - partial video conversion not working

Hi

I was testing again to get:

ffmpeg -i file_1.avi -ss 0:0:0 -t 0:14:00 -vcodec copy -acodec copy  file_1_2.avi

Today:

du -hs *
34M	file_1_2.avi
75M	file_1.avi

Before:

du -hs *
75M	file_1.avi
44K	file_2.avi

I really dont understand; but its working right now.

Thankyou all


OS:  Arch  &  Debian
System: HP Probook 440 G2
WM: Openbox

Offline

Board footer

Powered by FluxBB